为什么simpleXML_load_file()不会打开这个文件?

时间:2015-11-09 20:49:21

标签: php

$feed_url ="http://www.example.com/examplestring?format=RSS";

libxml_use_internal_errors(true);
$RSS_DOC = simpleXML_load_file($feed_url);
if (!$RSS_DOC) {
   echo "Failed loading XML\n";
  foreach (libxml_get_errors() as $error) {

      echo "\t", $error->message;
  }   
} 

我上面的代码加载其他rss feed,如:

http://example.blogspot.com/feeds/posts/default?alt=rss

$feed_url ="http://www.quiltexamples.com/rss.xml";

然而,对于我目前正在尝试加载的网址,我得到了:

PHP Warning: simplexml_load_file(http://www.example.com/examplestring?format=RSS): 
failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request
in ExamplelogParser.php on line 7
Failed loading XML

failed to load external entity "http://www.example.com/examplestring?format=RSS"

0 个答案:

没有答案