我试图查看Twitter API的搜索请求的所有页面,但它存货了:
tableView:heightForRowAtIndexPath
我试图用它作为旗帜:
$url = 'https://api.twitter.com/1.1/search/tweets.json';
$getfield = '?q=%23'.$hashtag.'&result_type=recent&include_entities=true&count=100';
$requestMethod = 'GET';
$twitter = new TwitterAPIExchange($settingsIdea);
$response = $twitter->setGetfield($getfield)
->buildOauth($url, $requestMethod)
->performRequest();
$json = json_decode($response);
foreach($json->statuses as $tweet){
// analyse each tweet
}
while (isset($json->search_metadata->next_results)):
$url = 'https://api.twitter.com/1.1/search/tweets.json';
$getfield = $json->search_metadata->next_results;
$response = $twitter->setGetfield($getfield)
->buildOauth($url, $requestMethod)
->performRequest();
$json = json_decode($response);
foreach($json->statuses as $tweet){
//analyze each tweet
}
endwhile;
但它并没有阻止循环。有关如何在所有页面中正确循环的任何想法吗?
其他问题:
isset($json->search_metadata->next_results)
作为$ getfield网址,因为它将“%”转换为“25”
echo $ json-> search_metadata-> next_results;
的输出示例$json->search_metadata->next_results
应该是:
?max_id=XXXXXXXXXX&q=2523hashtag&count=100&include_entities=1&result_type=recent