我有这个代码,以获得追随者和朋友(窥视你正在追随),然而我完全迷失了,我想得到一个“谁没有追随回来”的页面。做这件事最好的方法是什么?我应该手动搜索字符串还是。。。
伪::$riends-$追随者
$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);
}谢谢
发布于 2011-07-24 21:02:59
这可能不是最好的答案,但您可能想要阅读以下链接:
https://dev.twitter.com/docs/api/1/get/friendships/exists
因为你可以获得你正在关注的所有个人资料,你可以很容易地循环用户名数组,并卷曲到“友情验证”-page。查看下面的代码片段:
<?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 />';
}
?>这至少是值得一试的,尽管我非常确定有更好的方法来实现你正在寻找的东西。祝好运!
https://stackoverflow.com/questions/6805968
复制相似问题