获取特定用户的主题标签帖子

时间:2018-10-29 08:13:30

标签: php twitter

我想与特定用户一起使用带有特定主题标签的推文。我用了 这个要求。但这不起作用。但是在没有文档的情况下,它仍然有效,他们说这是有效的。

    <?php


require_once('TwitterAPIExchange.php');

/** Set access tokens here - see: https://dev.twitter.com/apps/ * */
$settings = array(
    'oauth_access_token' => "",
    'oauth_access_token_secret' => "",
    'consumer_key' => "",
    'consumer_secret' => ""
);

/** Note: Set the GET field BEFORE calling buildOauth(); * */
$url = 'https://api.twitter.com/1.1/search/tweets.json';
$requestMethod = 'GET';
$hashtag = 'zkst';
$getfield = '?q=from%3Ajulia44K%20%23' . $hashtag . '&result_type=mixed&include_entities=true&count=20';

// Perform the request
$twitter = new TwitterAPIExchange($settings);
$json_output = $twitter->setGetfield($getfield)
        ->buildOauth($url, $requestMethod)
        ->performRequest();

// Let's calculate how many results we got
$json = json_decode($json_output);
$n = count($json->statuses);
echo $n;

?>

0 个答案:

没有答案
相关问题