I'm having a horrible trouble getting this XML to be properly parsed through PHP's SimpleXMLElement. The error that I'm getting (below) is looking like it's a parsing error, but I can't seem to find any issue. And, since this is the National Weather Service's alerts feed, I would have to assume others are pulling this feed and getting it to correctly work.
I've tried all the the following and several variations of them:
$simpleFeed = new SimpleXMLElement(simplexml_load_string(file_get_contents('http://alerts.weather.gov/cap/us.php?x=0')));
and
$simpleFeed = new SimpleXMLElement(simplexml_load_string('http://alerts.weather.gov/cap/us.php?x=0'));
and
$simpleFeed = new SimpleXMLElement('http://alerts.weather.gov/cap/us.php?x=0', NULL, TRUE);
I've included the error that I'm currently getting, but the line numbers do occasionally change around (I'm not sure if that's my doing or the National Weather Service's Feed's doing):
SimpleXMLElement::__construct(): Entity: line 107: parser error : Start tag expected, '<' not found
SimpleXMLElement::__construct():
SimpleXMLElement::__construct(): ^
Every XML parser / validator that I run this through says that it's valid, with a few warnings. I'm not seeing anything here that would indicate the XML is the problem, except that the error message makes it look like that is the case.
Does anyone have experience with something like this and can help?