我正在尝试打开 XML 文件,但出现以下错误:
Warning: simplexml_load_file(http://www.bva.fr/fr/rss/sondages.xml) [function.simplexml-load-file]: failed to open stream: Redirection limit reached, aborting in /xxx/import.php on line 93
Warning: simplexml_load_file() [function.simplexml-load-file]: I/O warning : failed to load external entity "http://www.bva.fr/fr/rss/sondages.xml" in /xxx/import.php on line 93
Notice: Trying to get property of non-object in /xxx/import.php on line 99
Warning: Invalid argument supplied for foreach() in /xxx/import.php on line 99
第 99 行是:
foreach($xml->channel->item as $item)
我试过 :
$xml = simplexml_load_file($url);
和 :
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
$content = curl_exec($curl);
curl_close($curl);
$xml = simplexml_load_string($content);
但它仍然不起作用......
这是 XML 文件:http ://www.bva.fr/fr/rss/sondages.xml
请你帮助我好吗 ?