API Samples: Difference between revisions
From MobileX for SageCRM
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...") |
Crmtogether (talk | contribs) No edit summary |
||
(One intermediate revision by the same user not shown) | |||
Line 1: | Line 1: | ||
PHP sample code on how to make a request to logon and get a SID | PHP sample code on how to make a request to logon and get a SID | ||
echo ' | echo 'starting...'; | ||
$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/'); | ||
$options = array( | $options = array( | ||
'http' => array( | 'http' => array( | ||
Line 18: | Line 15: | ||
if ($result === FALSE) { /* Handle error */ } | if ($result === FALSE) { /* Handle error */ } | ||
var_dump($result); | var_dump($result); | ||
echo ' | echo 'Finished'; |
Latest 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';