Skip to content

Instantly share code, notes, and snippets.

@oquno
Created July 22, 2009 20:40
Show Gist options
  • Save oquno/152256 to your computer and use it in GitHub Desktop.
Save oquno/152256 to your computer and use it in GitHub Desktop.
<?php
$user="SCREEN_NAME";
$pass="PASSWORD";
$log="friends.txt";
$host="http://".$user.":".$pass."@twitter.com/";
$list=array();
$page=1;
while(1){
$api=$host."statuses/friends/".$user.".xml?page=".$page;
$xml=simplexml_load_file($api);
if($xml->user)
{
foreach($xml->user as $follower)
{
$screen_name=$follower->screen_name;
if(($follower->protected == "false")&&
(time() - strtotime($follower->status->created_at) < 60*60*24*14))
{
array_push($list, $screen_name);
}
}
}
else
{
break;
}
$page++;
}
$f=fopen($log, "w");
fwrite($f, implode("\n", $list));
fclose($f);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment