“守望轩”博客右侧边栏原来有个“杂感”的栏目,用来记录短的、不能大篇幅成文的短句,或者自己比较喜欢的短句和言论。
PHPjc/change this to your twitter username修改为你的twitter 用户名
04: $FeedURL='http://twitter.com/statuses/user_timeline/'.$username.'.RSS';
05: $excludePattern='/'.$username.': @/'; //excludes any @replies排除@replies 内容
06: $count=5;// show count
07: $i=0;
08:
09: if(!$xml=simplexml_load_file($FeedURL)){
10: trigger_error('Error',E_USER_ERROR);
11: }
12: foreach($xml->channel->item as $item) {
13: if ( ! preg_match("$excludePattern",$item->title)) {
14: $filteredTitle=htmlspecialchars("$item->title");
15: $filteredTitle=str_replace("$username: ","",$filteredTitle);
16: //Convert the time zone in China --转成中国时区
17: date_default_timezone_set('Asia/Shanghai');
18: $i++;
19:
20: if($i>$count)
21: {
22: break;
23: }
24: ?>
25: <li><?PHP echo $filteredTitle; ?>
26: (<?PHP echo date("Y-m-d H:i:s",strtotime($item->pubDate)); ?>)</li>
27: <?PHP } } ?>
28: <div align="right">
29: <a href="http://twitter.com/xjb" target="_blank">更多...</a></div>
30: <!-- my tritter -->