justlukeyou Posted January 19, 2013 Share Posted January 19, 2013 Hi, I am trying to publish Tweets onto a page. Does anyone know how it can be done? I have the following code but it doesn't work. <div class="twittercellwhyev"> <ol> <? $feed = json_decode(file_get_contents('https://api.twitter.com/1/statuses/user_timeline.json?include_entities=true&include_rts=true&screen_name=bbc&count=5')); $pattern = "/http:\/\/(www\.)?([^.]+\.[^.\s]+\.?[^.\s]*)/i"; $replace = "<a href='http://\\1\\2'>http://\\1\\2</a>"; foreach($feed as $output) { ?> <div class="twittercellinnerev"> <li> <? echo preg_replace($pattern,$replace,$output->text); ?> </div> </li> <? } ?> </ol> <div class="twitterwhyevimage"> <a href="http://twitter.com" rel="nofollow" > <img src="/images/followusontwitter.png" alt="Twitter.com"/> </a> </div> </div> Quote Link to comment https://forums.phpfreaks.com/topic/273355-publishing-tweets-on-a-page/ Share on other sites More sharing options...
trq Posted January 19, 2013 Share Posted January 19, 2013 Define "doesn't work". Quote Link to comment https://forums.phpfreaks.com/topic/273355-publishing-tweets-on-a-page/#findComment-1406910 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.