Random thoughts and notes

Notification when Twitter followers stop following

I tried out the Qwitter service (http://useqwitter.com) but it didn’t seem to work. Here’s my own solution:

#!/usr/bin/php
<?php
  $checkURL = "http://username:password@twitter.com/statuses/followers/username.xml?page=";

  $index = 1;
  $message = "";
  do {
    $followers = simplexml_load_file($checkURL.$index++); 
    for ($i=0; $iuser[$i]->screen_name);
    } 
  } while (count($followers)==100);

  $followers = file_get_contents('followers.txt');
  $followers = explode(',', $followers);

  for ($i=0; $i0) @mail('you@gmail.com','Lost Twitter Follower',"Lost followers:\n\n".$message);
  
  $fh = fopen('/Users/asoell/Script/followers.txt', 'w');
  fputs($fh, implode(',',$current_followers));
  fclose($fh);
?>

Comments