View Single Post
  #4  
Old 02-04-2008, 11:27 AM
mike mike is offline
Administrator
 
Join Date: May 2007
Posts: 273
Send a message via AIM to mike Send a message via MSN to mike Send a message via Yahoo to mike Send a message via Skype™ to mike

Bakum
I checked out your code and it looks okay to me, I cannot run it but I did create this script which works from my development account

PHP Code:

<?php
ini_set
("soap.wsdl_cache_enabled""0");
require_once (
'./includes/soapclient/SforcePartnerClient.php');
require_once (
'./includes/soapclient/SforceHeaderOptions.php');

//Salesforce Connection information
$wsdl './includes/soapclient/partner.wsdl.xml';
$userName "......";
$password "......";

$client = new SforcePartnerClient();
$client->createConnection($wsdl);
$loginResult $client->login($userName$password);


$soql "Select Id, Name FROM Product2";
//Processes the query to get account information from Salesforce
$records get_records($client$soql);

if (
$records)
{
    echo 
'<p>There are currently ' count($records) . ' accounts:</p>';

    
//Loops through all records which come back from get_accounts function and
    //stores them into an array $pass_this
    
foreach ($records as $r)
    {
        
//echo '<pre>' . print_r($r,true) . '</pre>';
        
echo "The Id for this is <strong>" .$r->Id[0]. "</strong> with a product name of <strong>" .$r->any"</strong><br />";
    }

}




function 
get_records($connection,$query)
{
    
$queryOptions = new QueryOptions(500);
    
$response $connection->query(($query), $queryOptions);
    
// check count to see if we are done
    
if ($response->size 0)
    {
        
$records $response->records;
        
// Cycles through additional responses if the number of records
        // exceeds the batch size
        
while (!$response->done)
        {
            
set_time_limit(100);
            
$response $connection->queryMore($response->queryLocator);
            
$records array_merge($records$response->records$queryOptions);
        }
    }

    return 
$records;
}

?>
See if this helps at all, sorry I could not be more help man!

~Mike
Reply With Quote