我想获得所有关注者列表,我使用OAuth。我的代码在这里。 通过这段代码,我得到了带逗号的alll id list
[51] => 378176058 [52] => 565040748 [53]
如何通过Twitter个人资料链接获取所有关注者的姓名:(
<?php
require_once('tmhOAuth.php');
require_once('tmhUtilities.php');
$profile_username = "savanpaun"; //twitter username
$oauth_access_token = "Your access token"; //Your access token
$oauth_access_token_secret = "Your access token secret"; //Your access token secret
$consumer_key = "Your key"; //Your key
$consumer_secret = "Your secret key"; //Your secret key
$tmhOAuth = new tmhOAuth(array(
'consumer_key' => $consumer_key,
'consumer_secret' => $consumer_secret,
'user_token' => $oauth_access_token,
'user_secret' => $oauth_access_token_secret,
'curl_ssl_verifypeer' => false
));
$code = $tmhOAuth->request(
'GET',
$tmhOAuth->url('1.1/friends/ids'),
array(
'screen_name' => $profile_username,
'count' => '300'
)
);
$response = $tmhOAuth->response['response'];
$following_ids = json_decode($response, true);
print_r($following_ids);
?>
答案 0 :(得分:0)
您想使用users/lookup API调用。
在上面的示例中,您将调用:
https://api.twitter.com/1.1/users/lookup.json?user_id=378176058,565040748
这将返回所有用户的无序列表。您可以解析它以查找名称。