Cullen Posted January 11, 2011 Share Posted January 11, 2011 how can you increase the page number in the following line until $status returns an empty result? curl_setopt($ch, CURLOPT_HTTPHEADER, array("Accept: application/xml", "Authorization: xxxxxxxxxxxxx:xxxxxxxxxxxxxxxx", "Page: 2")); Quote Link to comment https://forums.phpfreaks.com/topic/224109-increasing-a-number-inside-a-variable/ Share on other sites More sharing options...
Psycho Posted January 11, 2011 Share Posted January 11, 2011 I don't see where $status is being updated. If $status is never updated the loop would run indefinitely. I would probably add some sort of counter to halt execution at some outer boundry; $page = 1; while($status != null) { curl_setopt($ch, CURLOPT_HTTPHEADER, array("Accept: application/xml", "Authorization: xxxxxxxxxxxxx:xxxxxxxxxxxxxxxx", "Page: {$page}")); $page++; //Stop at 1000 pages to prevent infinite loop if($page>1000) { break; } } Quote Link to comment https://forums.phpfreaks.com/topic/224109-increasing-a-number-inside-a-variable/#findComment-1158006 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.