Created
August 15, 2011 10:43
-
-
Save ojimac/1146024 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* コマンドラインから、 | |
* % php hoge.php | |
* って感じで実行してください〜 | |
*/ | |
// コレ必要です → https://github.com/abraham/twitteroauth | |
require_once "./twitteroauth/twitteroauth/twitteroauth.php"; | |
$twitter = new TwitterOAuth( | |
// Consumer key | |
// Consumer secret | |
// Access token | |
// Access token secret | |
); | |
// フォローしている人全取得 | |
$friends = $twitter->OAuthRequest( | |
'http://api.twitter.com/1/friends/ids.xml', | |
'GET', | |
'' | |
); | |
$friends = simplexml_load_string($friends); | |
foreach( $friends->id as $user_id ) { | |
// ひたすら消す | |
$res = $twitter->OAuthRequest( | |
"http://api.twitter.com/1/friendships/destroy.xml", | |
"POST", | |
array('user_id' => "{$user_id}") | |
); | |
// 連続でAPI呼ぶとunfollowできないので、sleep入れてます | |
sleep(20); | |
echo "user_id:{$user_id}is destroy\n"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment