Trying to echo out all usernames via twitters public api. I get it to work if i skip the while loop. But i cant seems to get it to work with my loop.
$url = 'https://api.twitter.com/1.1/followers/list.json';
$getfield = '?screen_name=zarazentio1&count=200';
$requestMethod = 'GET';
$twitter = new TwitterAPIExchange($settings);
$result = $twitter->setGetfield($getfield)
->buildOauth($url, $requestMethod)
->performRequest();
$results = json_decode($result,true);
$getfield = $getfield.'&cursor='.$results["next_cursor"];
echo $nextpage;
## echo $results["users"]["2"]["screen_name"];
foreach($results["users"] as $follow) {
echo "</br>";
echo $follow["screen_name"];
}while ($results = $twitter->setGetfield($getfield)
->buildOauth($url, $requestMethod)
->performRequest());
While i do this it seems just to hang for a while then i get error from my host. If i remove this part (the last part).
while ($results = $twitter->setGetfield($getfield)
->buildOauth($url, $requestMethod)
->performRequest());
The script works. I get names from the first page. And i have checked so i get a cursor for next page. But i think i am not understanding the WHILE loop function at all.