/ Published in: PHP
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<? function ago($timestamp){ if($difference < 60) return $difference." seconds ago"; else{ if($difference < 60) return $difference." minutes ago"; else{ if($difference < 24) return $difference." hours ago"; else{ if($difference < 7) return $difference." days ago"; else{ return $difference." weeks ago"; } } } } } $username = "username here"; $format='json'; // set format $tweets=json_decode(file_get_contents("http://api.twitter.com/1/statuses/user_timeline/{$username}.{$format}")); // get tweets and decode them into a variable $tweet_count = 10; ?> <h5>LATEST TWEET<? if($tweet_count): ?>S<? endif ?></h5> <? $content = $tweet->text; // show latest tweet //<a href="http://twitter.com/#!/status/username/39762213950459904"> ?> <small><?= $time ?></a></small> <p><?= $content ?></p> <? endforeach ?>