Difference between revisions of "Freeside:1.9:Documentation:Developer/FS/SelfService/php/php examples"
From Freeside
Line 1: | Line 1: | ||
+ | == freeside.login_example.php == | ||
+ | |||
<pre> | <pre> | ||
<? | <? |
Revision as of 18:32, 6 April 2010
freeside.login_example.php
<? require('freeside.class.php'); $freeside = new FreesideSelfService(); $domain = 'example.com'; $response = $freeside->login( array( 'username' => strtolower($_POST['username']), 'domain' => $domain, 'password' => strtolower($_POST['password']), ) ); error_log("[login] received response from freeside: $response"); $error = $response['error']; if ( ! $error ) { // sucessful login $session_id = $response['session_id']; error_log("[login] logged into freeside with session_id=$session_id"); // store session id in your session store, to be used for other calls } else { // unsucessful login error_log("[login] error logging into freeside: $error"); // display error message to user } ?>