是否可以像这样实现:
http://api.twitter.com/1/friends/xxxxxx.json
但不是列出关注你的人,而是列出你正在关注的人?
是否可以像这样实现:
http://api.twitter.com/1/friends/xxxxxx.json
但不是列出关注你的人,而是列出你正在关注的人?
看起来这就是你需要的:
https://api.twitter.com/1.1/friends/ids.json?id=:screen_name_or_user_id
https://dev.twitter.com/docs/api/1.1/get/friends/ids
获取到ID列表后,您可以将它们作为逗号分隔的列表传递给另一个API调用来查找它们:
http://api.twitter.com/1.1/users/lookup.json?user_id=[comma delimited list goes here]
https://api.twitter.com/1/friends.json?screen_name=bitboxer
require_once('tmhOAuth.php');
require_once('tmhUtilities.php');
$profile_username = "abcdefg"; //twitter username
$oauth_access_token = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; //Your access token
$oauth_access_token_secret = "YYYYYYYYYYYYYYYYYYYYYYYYYY"; //Your access token secret
$consumer_key = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"; //Your key
$consumer_secret = "BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB"; //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' => '10'
)
);
$response = $tmhOAuth->response['response'];
$following_ids = json_decode($response, true);
print_r($following_ids);