Fred the Man Fred the Man - 2 months ago 4x
PHP Question

salesforce record object to string

I am trying to parse this object saleforce returns, however having no luck since it is not a String and I do not know how to make it a String.

Current code for the query:

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) {
} catch (Exception $e) {
echo $e->faultstring;

Here when printed/run returns something like this:

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

Assuming 3 records. I would like just to get the numbers instead, so it prints 8 then 11 then 5.

However substring does not work, and my attempts to change into a string have not worked. Any suggestion on how I could do this?


try this code

echo $record->DataIncluded__c

instead of


because $record is an object and Id is an array.