Skip to content

Instantly share code, notes, and snippets.

@dtolj
Created June 23, 2011 23:47
Show Gist options
  • Save dtolj/1043917 to your computer and use it in GitHub Desktop.
Save dtolj/1043917 to your computer and use it in GitHub Desktop.
twitter ticker
#!/usr/bin/php -q
<?php
//shell_exec('cd /var/www/html/');
chdir('/var/www/html/');
$webroot="/var/www/html/";
$xml = shell_exec("wget http://twitter.com/statuses/user_timeline/211898317.rss");
//echo ">>".$xml;
$xml_file = simplexml_load_file("211898317.rss");
if(count($xml_file->channel->item < 5)){
$y = count($xml_file->channel->item);
} else {
$y = 5;
}
//echo "y=".$y;
$fh = fopen("twitter.txt", 'w') or die('Could not open file!');
for($i = 0;$i<$y;$i++){
fwrite($fh, addslashes(str_replace('OTNTelemedicine: ', '', $xml_file->channel->item[$i]->description)."|sep|"));
}
fclose($fh);
shell_exec("rm 211898317.rss");
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment