現在、次のコードを使用して、Twitter フィードから最新のツイートを取得しています。
<?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>';
?>
MAMP では、これは完全に機能しますが、私のライブ サイトでは、サーバー側のエラー メッセージさえも表示されません。同様の投稿で、これはallow_url_fopen = On
php.iniで設定されていないことに関係している可能性があることを読みましたが、設定は違いがないようです。
Twitter が API の使用に関するポリシーを変更した可能性があるという事実 (私は変更したとは思いません) にもかかわらず、何が問題なのかわかりません。