Sign In
Password Recovery Register

Unfollow people we're following on Twitter which are not following us back.

A script to unfollow people we're following on Twitter which are not following us back, using the Abraham Williams TwitterOAuth PHP library.

 1 <?php
 2 
 3 $oTwitter = new TwitterOAuth
 4 (
 5 	YOUR_TWITTER_APP_CONSUMER_KEY,
 6 	YOUR_TWITTER_APP_CONSUMER_SECRET,
 7 	YOUR_TWITTER_APP_OAUTH_TOKEN,
 8 	YOUR_TWITTER_APP_OAUTH_SECRET
 9 );
10 
11 $aFollowing = $oTwitter->get('friends/ids');
12 $aFollowing = $aFollowing->ids;
13 
14 $aFollowers = $oTwitter->get('followers/ids');
15 $aFollowers = $aFollowers->ids;
16 
17 foreach( $aFollowing as $iFollowing )
18 {
19 	$isFollowing = in_array( $iFollowing, $aFollowers );
20 
21 	echo "$iFollowing: ".( $isFollowing ? 'OK' : '!!!' )."<br/>";
22 
23 	if( !$isFollowing )
24 	{
25 		$parameters = array( 'user_id' => $iFollowing );
26 		$status = $oTwitter->post('friendships/destroy', $parameters);
27 	}
28 }
29 
30 ?>

Comments

Login or Register to comment.


Embed Me!

Feel free to adjust iframe width and height according to your needs.

<iframe width="800px" 
        src="http://www.emoticode.net/embed/php/unfollow-people-were-following-on-twitter-which-are-not-following-us-back.html" 
        height="400px" 
        frameborder="0"> 
</iframe>

Here's how it will look like.