Skip to content

Instantly share code, notes, and snippets.

@j4y
Created August 13, 2011 16:57
Show Gist options
  • Save j4y/1144035 to your computer and use it in GitHub Desktop.
Save j4y/1144035 to your computer and use it in GitHub Desktop.
connecting to Landslide CRM's SOAP api using php
#!/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