我在使用带有 php 的 curl 库时遇到问题。我想要完成的是从两个不同的 url 返回的多个请求提取 xml,这些 url 用 curl 调用。这是代码:
$BROWSER="Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.1) Gecko/2008070208 YFF3 Firefox/3.0.1";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,"http://www.wowarmory.com/character-sheet.xml?r=Crushridge&n=Thief");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_BINARYTRANSFER, true);
curl_setopt($ch, CURLOPT_USERAGENT, $BROWSER);
$result20 = curl_exec($ch);
curl_close ($ch);
/**
I extract the values out of the xml here
**/
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,"http://www.wowarmory.com/character-sheet.xml?r=Ursin&n=Kiona");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_BINARYTRANSFER, true);
curl_setopt($ch, CURLOPT_USERAGENT, $BROWSER);
$result20 = curl_exec($ch);
curl_close ($ch);
/**
I extract the values out of the xml here
**/
当我进行第一次调用时,我可以提取值,但是当我进行第二次调用时,我可以提取值,但它们是第一次调用的值。