Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>This works to follow/unfollow with <a href="https://github.com/abraham/twitteroauth/tree/master/twitteroauth" rel="nofollow">twitteroauth.php + OAuth.php</a> and appi v1.1 if you have more than 5000 followers/friends. The 999 limit on the follow unfollow is because of the 1000 day limit. I got started <a href="http://www.emoticode.net/php/unfollow-people-were-following-on-twitter-which-are-not-following-us-back.html" rel="nofollow">with this</a> </p> <pre><code>//FULL FOLLOWERS ARRAY WITH CURSOR ( FOLLOWERS &gt; 5000) $e = 0; $cursor = -1; $full_followers = array(); do { //SET UP THE URL $follows = $oTwitter-&gt;get("followers/ids.json?screen_name=youruser&amp;cursor=".$cursor); $foll_array = (array)$follows; foreach ($foll_array['ids'] as $key =&gt; $val) { $full_followers[$e] = $val; $e++; } $cursor = $follows-&gt;next_cursor; } while ($cursor &gt; 0); echo "Number of followers:" .$e. "&lt;br /&gt;&lt;br /&gt;"; //FULL FRIEND ARRAY WITH CURSOR (FOLLOWING &gt; 5000) $e = 0; $cursor = -1; $full_friends = array(); do { $follow = $oTwitter-&gt;get("friends/ids.json?screen_name=youruser&amp;cursor=".$cursor); $foll_array = (array)$follow; foreach ($foll_array['ids'] as $key =&gt; $val) { $full_friends[$e] = $val; $e++; } $cursor = $follow-&gt;next_cursor; } while ($cursor &gt; 0); echo "Number of following:" .$e. "&lt;br /&gt;&lt;br /&gt;"; //IF I AM FOLLOWING USER AND HE IS NOT FOLLOWING ME BACK, I UNFOLLOW HIM $index=1; $unfollow_total = 0; foreach( $full_friends as $iFollow ) { $isFollowing = in_array( $iFollow, $full_followers ); echo $index .":"."$iFollow: ".( $isFollowing ? 'OK' : '!!!' )."&lt;br/&gt;"; $index++; if( !$isFollowing ) { $parameters = array( 'user_id' =&gt; $iFollow ); $status = $oTwitter-&gt;post('friendships/destroy', $parameters); $unfollow_total++; } if ($unfollow_total++; === 999) break; } </code></pre> <blockquote> <p>//IF USER IS FOLLOWING ME AND I AM NOT, I FOLLOW</p> </blockquote> <pre><code>$index=1; $follow_total = 0; foreach( $full_followers as $heFollows ) { $amFollowing = in_array( $heFollows, $full_friends ); echo "$heFollows: ".( $amFollowing ? 'OK' : '!!!' )."&lt;br/&gt;"; $index++; if( !$amFollowing ) { $parameters = array( 'user_id' =&gt; $heFollows ); $status = $oTwitter-&gt;post('friendships/create', $parameters); $follow_total++; } if ($follow_total === 999) break; } echo 'Unfollowed:'.$unfollow_total.'&lt;br /&gt;'; echo 'Followed:'.$follow_total.'&lt;br /&gt;'; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload