有人可以帮我解决这个问题。我对 google-api 调用的返回结果有疑问
我想将它们作为 html 回显,但 Firefox 一直显示提要页面。
在 IE 中,我收到一条错误消息,指出 xml 文档只能包含一个必须是原子“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
}
编辑
$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);
谢谢,理查德