Php 获取atom提要并在html中显示(google api)
有人能帮我解决这个问题吗。 我对google api调用的返回结果有问题 我想以html的形式回显它们,但firefox一直显示一个提要页面 在IE中,我得到一个错误,即xml文档只能包含一个顶级元素 wich必须是原子“feed”元素,所以我不明白 我能做些什么来改进这一点Php 获取atom提要并在html中显示(google api),php,curl,google-api,atom-feed,google-finance-api,Php,Curl,Google Api,Atom Feed,Google Finance Api,有人能帮我解决这个问题吗。 我对google api调用的返回结果有问题 我想以html的形式回显它们,但firefox一直显示一个提要页面 在IE中,我得到一个错误,即xml文档只能包含一个顶级元素 wich必须是原子“feed”元素,所以我不明白 我能做些什么来改进这一点 $response= curl_exec($ch); curl_close($ch); // Parse the response $response= simplexml_load_string($response)
$response= curl_exec($ch);
curl_close($ch);
// Parse the response
$response= simplexml_load_string($response);
foreach($response->entry as $position)
{
echo "position: " . $position->title . "<br />";
//next would be the stockvalue, but I don't yet know how to get that
}
编辑
我看到了我的错误
我没有使用
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
谢谢,Richard尝试var_dump()
你的$response
看看里面有什么数据
我将使用
file\u get\u contents()
而不是CURL
您可以提供API调用URL或您得到的XML响应吗?这可能会有帮助。仍然是相同的数据,我不知道发生了什么。他们在不同的网站/图特上显示相同的样本代码
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);