I am currently using the following code to retrieve the latest tweet from my Twitter feed:
<?php
$username='myUsername';
$format = 'json';
$tweet = json_decode(file_get_contents("http://api.twitter.com/1/statuses/user_timeline/{$username}.{$format}"));
$latestTweet = htmlentities($tweet[0]->text, ENT_QUOTES);
$latestTweet = preg_replace('/http:\/\/([a-z0-9_\.\-\+\&\!\#\~\/\,]+)/i', '<a href="http://$1" target="_blank">http://$1</a>', $latestTweet);
$latestTweet = preg_replace('/@([a-z0-9_]+)/i', '<a href="http://twitter.com/$1" target="_blank">@$1</a>', $latestTweet);
echo '<p class="inset white">'.$latestTweet.'</p>';
?>
On MAMP, this works perfectly, however on my live site, I get nothing, not even a server side error message. I read on a similar post that this may be something to do with allow_url_fopen = On
not being set in php.ini, but setting that appears to have made no difference.
Not withstanding the fact that Twitter may have changed their policy on usage of the API (which I don't believe they have), then I'm lost as to what could be the problem.