1. Go to this page and download the library: Download phpforce/soap-client library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
$accounts = $client->query(
'select Id, (select Id, Name from Contacts) from Account limit 10'
);
foreach ($accounts as $account) {
if (isset($account->Contacts)) {
foreach ($account->Contacts as $contact) {
echo sprintf("Contact %s has name %s\n", $contact->Id, $contact->Name);
}
}
}
$accounts = $client->query('Select Name from Account');
echo $accounts->count() . ' accounts returned';
foreach ($accounts as $account) {
// This will iterate over the 2000 first accounts, then fetch the next 2000
// and iterate over these, etc. In the end, all your organisations’s accounts
// will be iterated over.
}
$log = new \Monolog\Logger('name');
$log->pushHandler(new \Monolog\Handler\StreamHandler('path/to/your.log'));
$builder = new \Phpforce\SoapClient\ClientBuilder(
'/path/to/your/salesforce/wsdl/sandbox.enterprise.wsdl.xml',
'username',
'password',
'security_token'
);
$client = $builder->withLog($log)
->build();
bash
$ php composer.phar
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.