Skip to content

Instantly share code, notes, and snippets.

@ojimac
Created August 15, 2011 10:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ojimac/1146024 to your computer and use it in GitHub Desktop.
Save ojimac/1146024 to your computer and use it in GitHub Desktop.
<?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