卷入xml而不是网页

时间:2012-05-29 00:54:25

标签: php xml curl

好的,所以我使用以下代码来设置和检索curl url

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 15);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
$xml_response = curl_exec($ch);
curl_close($ch);
echo $xml_response; 

我的问题是我调用的api具有xml格式的数据,所以curl将数据返回到一个像这样的大字符串中

509f0e1f-b8d4-4cb8-b4f0-109751dca4eb0.0114370000000000TrueASIN0273702440SmallAll0273702440http://www.amazon.com/Accounting-Finance-Non-Specialists-Peter -....(ECT)

如何让curl以xml格式显示数据?

0 个答案:

没有答案