Rya*_*ush 2 twitter twitter-oauth
我正在尝试构建一个"关注"按钮,其上方有一个垂直关注者.我有一个解决方案,直到Twitter今天退出1.0 API,现在需要一个Oauth解决方案.我的问题是,最好的,最简单的解决方案是什么(最好是JS).
这是旧的解决方案
$.getJSON("https://api.twitter.com/1/users/show.json?callback=?&screen_name=twitter",
function(data) {
$('.here').text(data);
});
Run Code Online (Sandbox Code Playgroud)
而我现在得到的错误
GET https://api.twitter.com/1/users/show.json?callback=jQuery20205200183007400483_1371012819892&screen_name=twitter&_=1371012819893 410 (Gone)
Run Code Online (Sandbox Code Playgroud)
Mee*_*m R 11
我按照这一步,并获得推特追随者计数
使用此代码
$url = 'https://api.twitter.com/1.1/statuses/user_timeline.json';
$getfield = '?screen_name=Android';
$requestMethod = 'GET';
$twitter = new TwitterAPIExchange($settings);
$follow_count=$twitter->setGetfield($getfield)
->buildOauth($url, $requestMethod)
->performRequest();
$testCount = json_decode($follow_count, true);
echo "<pre>";
echo $testCount[0]['user']['followers_count'];
echo "</pre>";
Run Code Online (Sandbox Code Playgroud)
您可以更改"screen_name"并获取关注者计数.
干杯.
| 归档时间: |
|
| 查看次数: |
15009 次 |
| 最近记录: |