Skip to content

Instantly share code, notes, and snippets.

@lilliealbert
Created July 13, 2012 16:53
Show Gist options
  • Save lilliealbert/3105951 to your computer and use it in GitHub Desktop.
Save lilliealbert/3105951 to your computer and use it in GitHub Desktop.
public function getSubscriberList(){
$result = array();
$startIndex = 0;
$limit = 500;
$numberOfCurrentBatchRecord = $limit;
$numberOfBatchRan = 0;
$safeGardCount = 10;
while($limit == $numberOfCurrentBatchRecord && $numberOfBatchRan < $safeGardCount){
$startIndex = $limit * $numberOfBatchRan;
echo "get record from ".$startIndex." to ".($startIndex+$limit-1)."\n";
$response = $this->getVREmailList($this->getMasterListId(),$startIndex,$limit);
$numberOfCurrentBatchRecord = count($response);
echo "number of record found in this batch:".$numberOfCurrentBatchRecord."\n";
foreach ($response as $value){
foreach ($value->member_data as $memberDataProperty){
if(strcmp($memberDataProperty->name,"email_address")==0){
$result[]=$memberDataProperty->value;
}
}
}
$numberOfBatchRan++;
}
return $result;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment