I'm using the PHP API Client to connect to Marketo and pull all my leads. It's connecting ok, and it does pull data, but I only get about 240 leads. I should get 24000 or so. I placed the code I used below, and I have killed the process at various points, var_dump'ing both $success and $result, but it always shows a returnCount of ~239. I poste the beginning the the var_dump below the code.
What am I doing wrong that I can't pull all the leads?
Thanks for any help!
************************
Here is the function I wrote into the API Client for getMultipleLeads:
public function getMultipleLeads()
{
$retLead = null;
$params = new paramsGetMultipleLeads();
$params->batchSize = 1000; //Max 1000, default 1000
$options = array();
$authHdr = $this->_getAuthenticationHeader();
$result = array();
$streamPosition = 0;
do
{
$params->streamPosition = $streamPosition;
$success = $this->soapClient->__soapCall('getMultipleLeads', array($params), $options, $authHdr);
$result[] = $success;
$streamPosition = $success->result->newStreamPosition;
}
while($success->result->returnCount > 0); //I also used remainingCount, but got similar results
...it returns the $result array
**********************
var_dump results:
object(stdClass)#18 (1) {
["result"]=>
object(stdClass)#17 (4) {
["returnCount"]=>
int(237)
["remainingCount"]=>
int(0)
["newStreamPosition"]=>
string(34) "id:1302116:ts:1378308540:os:0:rc:0"
["leadRecordList"]=>
object(stdClass)#21 (1) {
["leadRecord"]=>
array(237) { //After this is all the lead data