[英]How to find total tweets of a user using twitter api v 1.1?
嗨,我想查找某个用户的总鸣叫次数,例如, 在这里您可以看到鸣叫数为14。我有api键,而所有我只想api调用。
我对此进行了编码
$twitteruser = "Username";
$notweets = 5000;
$consumerkey = "#########################";
$consumersecret = "###############################";
$accesstoken = "####################################";
$accesstokensecret = "$$$$$$$$$$$$$$$$$$$$$$$$$$$";
function getConnectionWithAccessToken($cons_key, $cons_secret, $oauth_token, $oauth_token_secret) {
$connection = new TwitterOAuth($cons_key, $cons_secret, $oauth_token, $oauth_token_secret);
return $connection;
}
$connection = getConnectionWithAccessToken($consumerkey, $consumersecret, $accesstoken, $accesstokensecret);
//
$following = $connection->get("https://api.twitter.com/1.1/friends/ids.json?cursor=-1&screen_name=".$twitteruser."&count=".$notweets);
echo'<pre>'; echo count($following->ids);
$followers = $connection->get("https://api.twitter.com/1.1/followers/ids.json?cursor=-1&screen_name=".$twitteruser."&count=".$notweets);
echo'<pre>'; echo count($followers->ids);
我得到follwoers
计数,然后following
计数,现在我希望总tweet
计数任何想法如何获得此?
看看这个:
$user = $connection->get("https://api.twitter.com/1.1/users/show.json?screen_name=".$twitteruser);
$following = intval($user->friends_count);
$followers = intval($user->followers_count);
$tweets = intval($user->statuses_count);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.