I’m stuck on what should be a simple line of code. I am making a call to a soap server and I need to page through the results. Here’s the code I have currently:
$field_pageNumber=0; //begin at zero and we'll pre-increment
while ($fields = $soap_client->__soapCall('readFields', array(
array(
'filter' => $fieldsFilter,
'pageNumber' => ++$field_pageNumber,
),
))) {
//...
}
Ignoring the actual code and what it does, my problem is simple. Loop through the soap calls until the return is finally empty (in this case will return an empty instance of stdClass). As it sits, however, I end up requesting 1 page too many (the final, empty response returns true).
I know this question will lead to a “duh” moment by me, but I’m stumped and I really want to move on.
Thanks