RyanMK
Still alive
Right, this script will display your most recent tweet on twitter.
You will need to make a file called latesttweet.php and insert the code below.
After you've done that, put this php code on you page wherever you want it to display.
Be sure to enter your twitter username in the include code above.
You will need to make a file called latesttweet.php and insert the code below.
PHP:
<?php
// This part pulls your twitter ID from the previous page.
$username = $twitterid;
// Prefix - some text you want displayed before your latest tweet. (HTML is OK, but be sure to escape quotes with backslashes: for example href=\"link.html\")
$prefix = "<p>";
// Suffix - some text you want display after your latest tweet. (Same rules as the prefix.)
$suffix = "<br /><a target=\"_blank\" href=\"http://twitter.com/".$twitterid."\"><em>http://twitter.com/".$twitterid."</em></a></p>";
// The Science.
$feed = "http://search.twitter.com/search.atom?q=from:" . $username . "&rpp=2";
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);
$tweet = str_replace(""", "\"", $tweet);
$tweet = str_replace("&apos;", "'", $tweet);
return $tweet;
}
$twitterFeed = file_get_contents($feed);
echo $prefix.parse_feed($twitterFeed).$suffix;
?>
PHP:
<?php
$twitterid = "Twitter Account";
require_once('latesttweet.php');?>