API Samples: Difference between revisions

From MobileX for SageCRM
(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...")
 
No edit summary
Line 3: Line 3:
   echo '<br /><br />starting...<br /><br />';
   echo '<br /><br />starting...<br /><br />';
   $url = 'http://www.server.com/CRM/custompages/sagecrmws/KonneXGateway.aspx?SID=NO%20SID&action=logon';
   $url = 'http://www.server.com/CRM/custompages/sagecrmws/KonneXGateway.aspx?SID=NO%20SID&action=logon';
   $data = array('dataonly' => 'Y',  
   $data = array('dataonly' => 'Y', 'username' => 'crmusername', 'password' => 'crmuserpassword', 'crmurl' => 'http://www.server.com/crm/');
'username' => 'crmusername',  
'password' => 'crmuserpassword',
'crmurl' => 'http://www.server.com/crm/');
   $options = array(
   $options = array(
     'http' => array(
     'http' => array(

Revision as of 10:07, 18 November 2016

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';