Php Twitter Identica Laconica

ptl
A while back I wrote a little bash script called IdentiBash, which, oddly enough, let me post and read to/from my lacomica account via the bash command line. Well, as of late I decided that that script really didn’t work very well with the xml/rss style feeds. It needed updating. Instead of turning to bash again it occurred to me that php5 has simplexml built in now. Well, that makes things really easy! In just a few minutes I cranked out a command line php script that will let me grab posts from Twitter, Identica, and Laconica servers. It works like a top too. The script is not complete yet as I am not sure quite yet what else I really want it to do and how I want it to handle those things, but it is a great start to any such project and I thought I would share. Especially for those people still using IdentiBash, this reader works much better and it’s really easy to expand upon if you are at all familiar with php. So here you have it, “ptil.sh”..

By the way, if you do anything wonderful with it, let me know, I’d like to see!


#!/usr/bin/php
/tmp/tweet.tmp");
$rss = simplexml_load_file("/tmp/tweet.tmp");
foreach ($rss->channel->item as $item)
{
echo "---------------------------------\n";
echo $item->pubDate."\n";
echo $item->title."\n";
}
?>

You’ll notice 2 puburl lines in there. The first is how I access my account in laconica/identica and the second is for twitter. They are given as examples and you’ll have to replace with your own urls. Simply put your info on the appropriate spots, make it executable and run it from the command line.

Be Sociable, Share!

Leave a Reply

You must be logged in to post a comment.