【发布时间】:2011-08-24 19:02:46
【问题描述】:
我正在为我的web-site 开发一个 PHP 推特提要。到目前为止,我已经弄清楚如何输出日期,但我想做的是挑选出网址并超链接它们。我还想挑选#hashtags,将它们超链接到搜索推特。我刚开始学习 PHP,所以任何帮助将不胜感激。
<?php
$count = 5;
$tweet=json_decode(file_get_contents("http://api.twitter.com/1/statuses/user_timeline/atrueresistance.json?count=".$count."" ));
for ($i=1; $i <= $count; $i++){
echo "<div class='tweet'>".$tweet[($i-1)]->text."
<div class='tweet_date'>". date("M \- j",strtotime($tweet[($i-1)]->created_at))."
</div>
</div>";
}
?>
【问题讨论】:
标签: php twitter file-get-contents json