API Samples

From MobileX for SageCRM
Revision as of 10:07, 18 November 2016 by Crmtogether (talk | contribs) (Created page with "PHP sample code on how to make a request to logon and get a SID echo '<br /><br />starting...<br /><br />'; $url = 'http://www.server.com/CRM/custompages/sagecrmws/KonneX...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

PHP sample code on how to make a request to logon and get a SID

 echo '

starting...

'; $url = 'http://www.server.com/CRM/custompages/sagecrmws/KonneXGateway.aspx?SID=NO%20SID&action=logon'; $data = array('dataonly' => 'Y',

'username' => 'crmusername', 'password' => 'crmuserpassword', 'crmurl' => 'http://www.server.com/crm/');

 $options = array(
   'http' => array(
       'header'  => "Content-type: application/x-www-form-urlencoded\r\n",
       'method'  => 'POST',
       'content' => http_build_query($data)
   )
 );
 $context  = stream_context_create($options);
 $result = file_get_contents($url, false, $context);
 if ($result === FALSE) { /* Handle error */ }
 var_dump($result);
 echo '

Finished';