In my controller, I have the following function…it should run thru numerous loops, but for some reason
returns after just the initial 100. I almost think it is not setting the start_element on subsequent loops.
protected function processJson($url, $auth, $params )
{
$rec = 0;
$start_element = 0;
$num_elements = 100;
$params = array(""); //array("start_element"=>$start_element);
$obj = $this->getJson($url, $auth, $params);
$count = $obj->response->count; // total count of items
if ($count < $num_elements)
$num_elements = $count;
if ($count > 0 )
$arraydata = array();
if ($rec < $count ) {
if ($count-$rec < $num_elements )
$num_elements = $count-$rec;
for ($i=0 ; $i<$num_elements; $i++) {
$arraydata[$i+$rec] = array(
"id" => $obj->response->publishers[$i]->id,
"name" => $obj->response->publishers[$i]->name
);
} //inner loop
$rec = $rec + $num_elements ;
$start_element = $start_element + $num_elements;
$params = array("start_element"=>$start_element);
$obj = $this->getJson($url, $auth, $params);
}// outer loop
return $arraydata;
}