+ -
当前位置:首页 → 问答吧 → 我想调用新浪微博api,但是地址在网页中打开是xml,为什么我就获取不到xml值呢,请看代码

我想调用新浪微博api,但是地址在网页中打开是xml,为什么我就获取不到xml值呢,请看代码

时间:2011-10-18

来源:互联网

PHP code

$file_get=@file_get_contents("http://api.t.sina.com.cn/statuses/user_timeline.xml?source=3561545544");
$location = json_decode($file_get);
print_r($location);


//但是http://api.t.sina.com.cn/statuses/user_timeline.xml?source=3561545544这个页面打开是xml数据,我为什么不能获取到值呢


作者: nixiang2012   发布时间: 2011-10-18

$file_get又不是json数据,你干嘛json_decode呢? 直接echo $file_get; 即可。

作者: jordan102   发布时间: 2011-10-18