Jump to content


Photo

Publishing Tweets On A Page


  • Please log in to reply
1 reply to this topic

#1 justlukeyou

justlukeyou

    Advanced Member

  • Members
  • PipPipPip
  • 966 posts

Posted 19 January 2013 - 07:02 AM

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>


#2 trq

trq

    Advanced Member

  • Administrators
  • 30,904 posts
  • LocationSydney, Australia.

Posted 19 January 2013 - 07:27 AM

Define "doesn't work".

http://thorpesystems.com | http://proemframework.org | http://github.com/trq

SmtpCatcher - A very simple mock sendmail useful for testing PHP mail scripts.
OPM - My Linux package manager.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

Cheap Linux VPS from $5
SSD Storage, 30 day Guarantee
1 TB of BW, 100% Network Uptime

AlphaBit.com