You have a website and you have a twitter account. Surely you want to show your twitter status on your website, if i ain’t wrong :D.
Please check the following different steps to get the status and show it on your website,
1. Fetch Status Using php,
Place the code bellow inside your function.php file. Don’t forget to change the “TwitterProfileName” with your twitter profile name.
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;
}
function getTweet(){
$feed = “http://search.twitter.com/search.atom?q=from:TwitterProfileName&rpp=1″;
$twitterFeed = file_get_contents($feed);
echo parse_feed($twitterFeed);
}
Now wherever you like to show the twitter status just call the getTweet() function.
2. You can also fetch the JSON using PHP like this (replacing your username),
<?php
$json = file_get_contents(“http://twitter.com/statuses/user_timeline/username.json”);
$json = json_decode($json, true);
// to display the current status use the following one
echo $json[0][‘text’];
// to display the last 3 status use the following one
for($i=0; $i < 3 && isset($json[$i]); $i++)
{
echo $json[$i][‘text’].'<br>’;
}
?>