Reputation: 31
How to find who unfollowed me?
Can anyone have such a php script using the Twitter API. It is necessary that the Twitter messages sent to those who unsubscribed from me.
Note: I know that already have special services, but I need your, simple service that would be output to a tweet from me unsubscribing users.
Thank you.
Upvotes: 3
Views: 2149
Reputation: 2591
That is not possible with a simple API call but you can save each user's followers and every next time you check you subtract the new array from the old array.
Basically something like this:
$array1 = get_old_followers_ids (); // ex. from db
$array2 = get("followers/ids.json?screen_name=me");
$users = array_diff($array1, $array2);
$users = get ("users/lookup.json?user_id=" . implode(',', $users));
where get
would be your API calling function. The only way to do this is to poll the data.
Note that the example script has it's limitations. For example if more than 100 users have unfollowed you since the the last time you saved values $array1
, only 100 users will be returned.
Upvotes: 4