Time for latest tweet
-
Currently I’m using this slip of code to grab the latest tweet of a user on Twitter. I’m looking for a command that will also grab the time it was tweeted at. This is probably a very simple line of code, I’m just not fluent in PHP yet. This is what I have so far…Thanks
<?php $username = "Username"; // Your twitter username. $prefix = ""; // Prefix - some text you want displayed before your latest tweet. $suffix = ""; // Suffix - some text you want display after your latest tweet. $feed = "http://search.twitter.com/search.atom?q=from:" . $username . "&rpp=1"; function parse_feed($feed) { $stepOne = explode("<content type=\"html\">", $feed); $stepTwo = explode("</content>", $stepOne[1]); $tweet = $stepTwo[0]; $tweet = str_replace("<", "<", $tweet); $tweet = str_replace(">", ">", $tweet); return $tweet; } $twitterFeed = file_get_contents($feed); echo stripslashes($prefix) . parse_feed($twitterFeed) . stripslashes($suffix); ?>
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
The topic ‘Time for latest tweet’ is closed to new replies.