原始代码是
$twitter = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, ACCESS_TOKEN, ACCESS_TOKEN_SECRET);
$twitter->host = "http://www.search.twitter.com/";
$search = $twitter->get('search', array('q' => '#hashtag', 'rpp' => 4));
$twitter->host = "https://api.twitter.com/1.1/";
foreach($search->results as $tweet) {
$status = 'RT @'.$tweet->from_user.' '.$tweet->text;
if(strlen($status) > 140) $status = substr($status, 0, 139);
$twitter->post('statuses/update', array('status' => $status));
}
echo "Success! Check your twitter bot for retweets!";
这最初会搜索某个关键字并在推特上发布该主题标签所说的内容。
$twitter = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, ACCESS_TOKEN, ACCESS_TOKEN_SECRET);
$twitter->host = "https://twitter.com/search?q=from%3Aeurogamer%2C%20OR%20from%3Anintendolife%2C%20OR%20from%3Aoutsidexbox&src=typd";
$search = $twitter->get('search', array('q' => '', 'rpp' => 4));
$twitter->host = "https://api.twitter.com/1.1/";
foreach($search->results as $tweet) {
$status = 'RT @'.$tweet->from_user.' '.$tweet->text;
if(strlen($status) > 140) $status = substr($status, 0, 139);
$twitter->post('statuses/update', array('status' => $status));
}
echo "Success! Check your twitter bot for retweets!";
我想我不再需要 $search 了,我仍然需要将标准设置为仅发布 4 但我该如何解决这个问题?