开发者

XML Parsing - Fatal Error

开发者 https://www.devze.com 2023-02-23 11:08 出处:网络
I\'m trying to parse the following http://www.patrickarundell.net/THREE-IE-FEED.asp. My code is as follows:

I'm trying to parse the following http://www.patrickarundell.net/THREE-IE-FEED.asp. My code is as follows:

$xml = new SimpleXMLElement('http://www.patrickarundell.net/THREE-IE-FEED.asp', NULL, TRUE);
echo $xml->asXML();

but I'm getting the following error:

Fatal error: Uncaught exception 'Exception' with message 'String could not be parsed as XML' in /content/HostingPlus/c/r/xxxxxxxxxx.com/subdomains/demo3/web/XMLParser.php:15 Stack trace: #0 /content/HostingPlus/c/r/xxxxxxxx.com/subdomai开发者_如何转开发ns/demo3/web/XMLParser.php(15): SimpleXMLElement->__construct('http://www.patr...', 0, true) #1 {main} thrown in /content/HostingPlus/c/r/xxxxxxxxxx.com/subdomains/demo3/web/XMLParser.php on line 15

I've been googling for a few hours, but not having much luck finding an answer. Any help appreciated.

Regards, Stephen


Download the file and parse the local version. It parses correctly. On the server where the file is places, however, I'm seeing poor responsiveness. My guess is that this simple XML interface uses poor error messages that lead you to believe that there is a parsing problem when in fact there is a network connectivity problem.


Well, your code works for me. I got no such error when I ran your code. However, this was on the Apache 2 server on my computer, and PHP's permissions may be somewhat looser than on the machine you're running your code on.

What happens if you simply fetch and display the contents of the URL, using something like the following?

echo file_get_contents('http://www.patrickarundell.net/THREE-IE-FEED.asp');
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号