チップス
twitter test 自分がフォローしているのにフォローしてくれないフォロワーを取得する
OAuthRequest("https://api.twitter.com/1.1/statuses/user_timeline.json","GET",array("count"=>"10"));
// 自分がフォローしているユーザーidの一覧を取得
$req = $twObj->OAuthRequest("https://api.twitter.com/1.1/friends/ids.json","GET",array("cursor" => "-1", "screen_name" => "$myname"));
$follow = json_decode($req)->ids;
$follow = array_reverse($follow);
// 自分のフォロワーのidの一覧を取得
$req2 = $twObj->OAuthRequest("https://api.twitter.com/1.1/followers/ids.json","GET",array("cursor" => "-1", "screen_name" => "$myname"));
// http://www.tryphp.net/2012/01/24/phpapptwitter-followers_ids/
$follower = json_decode($req2)->ids;
$follower = array_reverse($follower);
$results = array_diff( $follow, $follower);
if (isset($results)) {
foreach ($results as $val){
$wkid = strval($val);
$wkreq = $twObj->OAuthRequest("https://api.twitter.com/1.1/users/show.json","GET",array("include_entities"=>"true","user_id"=>"$wkid"));
print "$wkid : " . json_decode($wkreq)->name . " : " . json_decode($wkreq)->screen_name . "
";
}
}
?>
参考URL
https://github.com/snghrym/cron/blob/master/twisys/remove.php