• Ed.ax86
  • NEWBIE
  • 0 Points
  • Member since 2004

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 3
    Replies
Hi All, Im experiencing an odd but perhaps easy fix/oversight on using QueryMore.

1) My PHP code is trying to query all contacts ( 5000 + )
2) My code successfully seems to work partially. It works in 200 contact chunks Using QueryMore and prints the IDs out. ( Im printing them out for now..but when this works I will be doing other things )
BUT
3) Upon hitting 2000 it hangs in the browser ( does not continue printing anything )

My code looks like this: ( yes I left in the echos to see what Im doing right or wrong )
===========================

    $queryResult = $sfdc->query("select id, firstname, lastname, phone, fax from contact");
    $j=0;
    while ($queryResult->done == false)  {

        $records = $queryResult['records'];
        for( $i=0; $i<count($records); $i++){
            $contactId = $records[$i]->id;
            echo "<br> $j -".$contactId;
            $j++;
        }

        $locator = $queryResult['queryLocator'];
        echo "<h2>- $locator -</h2>";
        $queryResult = $sfdc->queryMore($locator);
    }

echo "Done";

===========================

To recap...this works fine in 200 unit chunks but hangs when the locator has reached 2000 as the locator ID looks like '01g5000000xxxxxxx-2000', so in my case only 2000 contacts are printed and the "Done" is never printed.

Thoughts on what I'm doing wrong?
Thanks!
We need assistance getting a web to lead form processed in PHP. We have the script setup to email, write the data to mySQL and POST the data to SalesForce. We have not been able to get the SalesForce part to work.

Please help.
Does anyone have sample PHP code leveraging the NuSoap library that they would be willing to share depicting how to interface with the Sforce API?  I've been tinkering for a while now, and just can't get it working.  A little sample code should get me kick-started.  Thanks!