$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"