salesforce 记录对象到字符串

salesforce record object to string

我正在尝试解析这个对象 saleforce returns,但是没有成功,因为它不是一个字符串,而且我不知道如何将它变成一个字符串。

查询的当前代码:

<?php
    define("SOAP_CLIENT_BASEDIR", "../../soapclient");
    require_once (SOAP_CLIENT_BASEDIR.'/SforceEnterpriseClient.php');
    require_once ('../userAuth.php');
    try {
      $mySforceConnection = new SforceEnterpriseClient();
      $mySoapClient = $mySforceConnection->createConnection(SOAP_CLIENT_BASEDIR.'/enterprise.wsdl.xml');
      $mylogin = $mySforceConnection->login($USERNAME, $PASSWORD);
      $query = 'SELECT DataIncluded__c from GMC_Contract__c limit 5';
      $response = $mySforceConnection->query(($query));
      foreach ($response->records as $record) {
        print_r($record);
        print_r("<br>");
      }
    } catch (Exception $e) {
      echo $e->faultstring;
    }
    ?>

这里当 printed/run returns 是这样的:

stdClass Object ( [Id] => [DataIncluded__c] => 8 )
stdClass Object ( [Id] => [DataIncluded__c] => 11 )
stdClass Object ( [Id] => [DataIncluded__c] => 5 ) 

假设有 3 条记录。我只想得到数字,所以它打印 8 然后 11 然后 5.

但是子字符串不起作用,我尝试转换成字符串也没有起作用。对我如何做到这一点有什么建议吗?

试试这个代码

echo $record->DataIncluded__c

而不是

print_r($record)

因为$record是一个对象而Id是一个数组。