得到原子饲料和显示HTML(谷歌-API)
-
21-09-2019 - |
题
谁能帮我出这一点。 我有个问题与来自谷歌-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
。
不隶属于 StackOverflow