I have successfully connected to SalesForce using the Soap API and the Force.com toolkit for php.

When returning records, however, I am getting part xml responses:

SELECT Id, Name, Organisation_Name__c,County__c, Post_Code__c, Street__c
        from Organisation_Services__c LIMIT 1

Doing a var_dump on the result gives me:

  public 'type' => string 'Organisation_Services__c'
  public 'Id' => 
    array (size=2)
      0 => string 'a0Vb0000000i9FTEAY'
      1 => string 'a0Vb0000000i9FTEAY'
  public 'any' => string '<sf:Name>SRV- 00002</sf:Name><sf:Organisation_Name__c>001b0000006ltMwAAI</sf:Organisation_Name__c><sf:County__c xsi:nil="true"/><sf:Post_Code__c xsi:nil="true"/><sf:Street__c xsi:nil="true"/>'
  1. Why are there two items in the Id?
  2. Why are all the other attributes stuffed into the 'any' object?

2 Answers 2


Right, so once the response has been received, you then need to convert it as follows:

foreach ($response as $record)
  $sObject = new SObject($record);


foreach ($response as $record){

  $sObject = new SObject($record);
     echo "ID: ".$record->Id . "<br>Nome: " . $record->FirstName . "<br> "
    ." Sobrenome: ". $record->LastName . "<br> " . $record->Phone . "<br/>\n";


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .