谁能帮我出这一点。 我有个问题与来自谷歌-API调用

的返回结果

欲回声回为html,但Firefox持续显示的进料页。

在IE中,我得到一个错误说,一个XML文档只能包含一个顶层元件 至极必须是原子“进料”的元素,所以不明白了。

我能做些什么来改善呢?

$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

}

修改

$headers = array(
    "Authorization: GoogleLogin auth=" . $auth,
    "GData-Version: 2",
);

 $ch=curl_init(); 
curl_setopt($ch, CURLOPT_URL, "http://finance.google.com/finance/feeds/default/portfolios/1/positions");
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

修改 我看到我的错 我没有使用

curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);

感谢,理查德

有帮助吗?

解决方案

尝试var_dump()$response,看看你有什么里面的数据。

和我将使用file_get_contents()代替CURL

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top