Take the 2-minute tour ×
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It's 100% free, no registration required.

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:

object(stdClass)
  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?
share|improve this question

2 Answers 2

up vote 1 down vote accepted

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

foreach ($response as $record)
{
  $sObject = new SObject($record);
  var_dump($sObject);
}
share|improve this answer

Excellent!

foreach ($response as $record){

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

 }
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.