Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/design-patterns/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 获取atom提要并在html中显示(google api)_Php_Curl_Google Api_Atom Feed_Google Finance Api - Fatal编程技术网

Php 获取atom提要并在html中显示(google api)

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)

有人能帮我解决这个问题吗。 我对google api调用的返回结果有问题

我想以html的形式回显它们,但firefox一直显示一个提要页面

在IE中,我得到一个错误,即xml文档只能包含一个顶级元素 wich必须是原子“feed”元素,所以我不明白

我能做些什么来改进这一点

$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);