Created
August 13, 2011 16:57
-
-
Save j4y/1144035 to your computer and use it in GitHub Desktop.
connecting to Landslide CRM's SOAP api using php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env php | |
<?php | |
$lsInstanceName = 'jaytest'; | |
$lsUserName = 'XxXxXxXxXx@landslide.com'; | |
$lsSecPwrd = 'XxXxXxXxXxXxXxXxXxXx'; | |
$lsApiPass = md5($lsSecPwrd.$lsInstanceName); | |
$lsApiEndpointHost = 'api.landslide.com'; | |
$lsApiEndpointURL = "https://${lsInstanceName}.${lsApiEndpointHost}/webservices/SoapService"; | |
$lsApiNamespace = 'http://www.landslide.com/webservices/SoapService'; | |
$client = new SoapClient("${lsApiEndpointURL}?WSDL", array('soap_version' => 1)); | |
$sessionHeader = '<urn:SessionHeader xmlns:urn="' . $lsApiNamespace . '" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">' | |
.'<urn:sessionId>LOGINTOKEN=' . $lsInstanceName . '</urn:sessionId></urn:SessionHeader>'; | |
$soapVar = new SoapVar($sessionHeader, XSD_ANYXML, null, null, null); | |
$soapHeader = new SoapHeader($lsApiEndpointURL, 'SessionHeader', $soapVar); | |
$client->__setSoapHeaders(array($soapHeader)); | |
$result = $client->login(array('wsUser' => array('entityId' => 0, 'username' => $lsUserName, 'password' => $lsApiPass))); | |
var_dump($result->loginResponse->sessionId); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment