我有这个代码,得到追随者和朋友(窥视你是以下),但我完全迷路了,我想得到一个"谁不跟随回来"的页面。最好的方法是什么?我应该手动搜索字符串还是…
伪::$ friends -$follower
$user = $query[1];
if (!$user) {
user_ensure_authenticated();
$user = user_current_username();
}
$folwers = API_URL."statuses/followers/{$user}.xml";
$folwin = API_URL."statuses/friends/{$user}.xml";
$tl = lists_paginated_process($request);
$content = theme('followers', $tl);
theme('page', 'Followers', $content);
}
谢谢
这可能不是最理想的答案,但您可能想要阅读以下链接:
https://dev.twitter.com/docs/api/1/get/friendships/exists既然你能够得到你所关注的所有配置文件,你可以很容易地循环用户名数组并旋转到"友谊验证"页面。查看下面的代码片段:
<?php
$link = 'http://api.twitter.com/1/friendships/exists.xml?screen_name_a=php_net&screen_name_b=';
foreach( $usernames as $username ) {
//Create a curl handler and make sure we return to a variable
$ch = curl_init($link . $username);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$status = strip_tags(curl_exec($ch)); //Should return: true
curl_close($ch);
//Output based on the results
if( $status == 'true' ) echo $username , ' isn''t following you. <br />';
else echo $username , ' is following you. <br />';
}
?>
这可能至少值得一试,尽管我很确定有更好的方法来完成你正在寻找的。好运!