【发布时间】:2011-09-02 19:32:45
【问题描述】:
我已经在谷歌上搜索了几个小时,但还没有找到解决这个问题的方法。
目前,我从 twitter xml 文件中检索数据:http://twitter.com/statuses/user_timeline.xml?screen_name=clubbluecanopy
一切正常,我的日期格式显示:Fri Aug 12 03:25:40 +0000 2011 但我希望它显示:17 天前
这是我的 flash as3 代码:
var myXMLLoader:URLLoader = new URLLoader();
//myXMLLoader.load(new URLRequest("http://twitter.com/statuses/user_timeline.xml?screen_name=arunshourie"));
myXMLLoader.load(new URLRequest("twitter.php"));
myXMLLoader.addEventListener(Event.COMPLETE, processXML);
function processXML(e:Event):void{
var myXML:XML = new XML(e.target.data);
trace(myXML.status[0].text);
tweet_1.text = String(myXML.status[0].text);
time.text= String(myXML.status[0].created_at);
}
这是php代码:
<?php
/*
* @return string
* @param string $url
* @desc Return string content from a remote file
* @author Luiz Miguel Axcar (lmaxcar@yahoo.com.br)
*/
function get_content($url)
{
$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_HEADER, 0);
ob_start();
curl_exec ($ch);
curl_close ($ch);
$string = ob_get_contents();
ob_end_clean();
return $string;
}
#usage:
$content = get_content ("http://twitter.com/statuses/user_timeline.xml?screen_name=clubbluecanopy");
echo $content;
?>
我也用过crossdomain.xml
如果有人可以帮助我,将不胜感激!谢谢! :)
【问题讨论】: