Twitter API只返回4条推文,但实际上还有更多

时间:2016-09-10 10:04:15

标签: php twitter

我今天在PHP上尝试使用Twitter API。我导入了twitteroauth库并调用了一个简单的标签。问题是,如果我在Twitter本身浏览并搜索相同的#标签,那么有很多这样的推文,但api只返回4条推文。如果我将hashtag更改为其他内容,则返回完整列表。我究竟做错了什么?以下是代码:

$connection = new TwitterOAuth($consumerkey, $consumersecret, $access_token, $access_token_secret);
$content = $connection->get("search/tweets", ["q" => "#cutserv"]);
foreach($content->statuses as $tweet)
{
echo "Tweet: ".$tweet->text;
echo "<br/>";
echo "Time: ".$tweet->created_at;
echo "<br/><hr/>";
}

响应永远是这样的:

Tweet: You need high-performers for great #cutserv
Time: Fri Sep 09 09:10:21 +0000 2016
Tweet: I join 62 other experts to discuss #cutserv improvement w/ @onereach.
Time: Wed Sep 07 23:01:28 +0000 2016
Tweet: “Immerse yourself in the customer's world and get to know their struggles and triumphs inside out.” ― Dane Brookes #quote #cutserv
Time: Mon Sep 05 13:14:53 +0000 2016
Tweet: You need high-performers for great #cutserv
Time: Fri Sep 02 09:10:23 +0000 2016

1 个答案:

答案 0 :(得分:1)

来自Documentation

  

Twitter Search API搜索过去 7天中发布的最近推文的抽样

重点补充。 API只会让您搜索推文的最后一周。使用该网站,您可以搜索所有内容。