Sample Call
<?php
// SOAP_CLIENT_BASEDIR - folder that contains the PHP Toolkit and your WSDL
// $USERNAME - variable that contains your Salesforce.com username (must be in the form of an email)
// $PASSWORD - variable that contains your Salesforce.ocm password
define("SOAP_CLIENT_BASEDIR", "../../soapclient");
require_once (SOAP_CLIENT_BASEDIR.'/SforcePartnerClient.php');
require_once (SOAP_CLIENT_BASEDIR.'/SforceHeaderOptions.php');
try {
$mySforceConnection = new SforcePartnerClient();
$mySoapClient = $mySforceConnection->createConnection(SOAP_CLIENT_BASEDIR.'/partner.wsdl.xml');
$mylogin = $mySforceConnection->login($USERNAME, $PASSWORD);
$query = 'SELECT Id,Name,BillingStreet,BillingCity,BillingState,Phone,Fax from Account Limit 1';
$response = $mySforceConnection->query($query);
$queryResult = new QueryResult($response);
foreach ($queryResult->records as $record) {
print_r($record);
}
} catch (Exception $e) {
print_r($mySforceConnection->getLastRequest());
echo $e->faultstring;
}
?>
Sample Output
SObject Object
(
[type] => Account
[fields] => SimpleXMLElement Object
(
[Name] => Golden Straw
[BillingStreet] => 4322 Haystack Boulevard
[BillingCity] => Wichita
[BillingState] => KA
[Phone] => 666.666.6666
[Fax] => 555.555.5555
)
[Id] => 0015000000L3zYdAAJ
)