Im trying to get the timestamps for tweets to appear on my site but can’t get it to work.
Anyone any ideas?
Follow us on Twitter @??????????
- <?php
$reg_exUrl = "/(http|https|ftp|ftps)\:\/\/[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(\/\S*)?/";
$json = file_get_contents('http://api.twitter.com/1/statuses/user_timeline.json?screen_name=??????????&count=3&include_rts=1');
$tweets = json_decode($json, true);
foreach($tweets as $tweet => $text)
{
$myText = $text['text'];
$myTexts = utf8_decode($myText);
//$myTexts = utf8($myText);
//echo "utf8 : " . $myTexts . "<br/>";
// Check if there is a url in the text
if(preg_match($reg_exUrl, $myTexts, $url))
{
// make the urls hyper links
echo preg_replace($reg_exUrl, "<a href='{$url[0]}''>{$url[0]}</a> ", $myTexts);
}
else
{
// if no urls in the text just return the text
echo $myTexts;
}
//echo $test['text'];
echo "<br/>";
echo "<br/>";
}
?> </li></ul>