Skip to content

Instantly share code, notes, and snippets.

@zooniverse
Created April 8, 2011 14:13
Show Gist options
  • Save zooniverse/909912 to your computer and use it in GitHub Desktop.
Save zooniverse/909912 to your computer and use it in GitHub Desktop.
Capture all of the tweets that have the word 'bieber' in them and save them to a file
<?php
$fp = fopen("http://USERNAME:PASSWORD@stream.twitter.com/1/statuses/filter.json?track=bieber","r");
while($data = fgets($fp))
{
$time = date("YmdH");
if ($newTime!=$time)
{
@fclose($fp2);
$fp2 = fopen("{$time}.txt","a");
}
fputs($fp2,$data);
$newTime = $time;
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment