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.'/SforceEnterpriseClient.php');

try {
  $mySforceConnection = new SforceEnterpriseClient();
  $mySoapClient = $mySforceConnection->createConnection(SOAP_CLIENT_BASEDIR.'/enterprise.wsdl.xml');
  $mylogin = $mySforceConnection->login($USERNAME, $PASSWORD);
  
  $query = 'SELECT Id,Name from Account limit 5';
  $response = $mySforceConnection->query(($query));

  foreach ($response->records as $record) {
    print_r($record);
  }
} catch (Exception $e) {
  echo $e->faultstring;
}
?>

Sample Output

stdClass Object
(
    [Id] => 0015000000F7Ib3AAF
    [Name] => TestCompany
)
stdClass Object
(
    [Id] => 0015000000L3zYdAAJ
    [Name] => Golden Straw
)
stdClass Object
(
    [Id] => 0015000000L3zYcAAJ
    [Name] => Golden Straw
)
stdClass Object
(
    [Id] => 0013000000BoWRHAA3
    [Name] => TestAccountName
)
stdClass Object
(
    [Id] => 0013000000BNbsRAAT
    [Name] => Express Logistics and Transport
)