Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Simple XML namespace warning

I am trying to parse the following XML using simplexml...

http://datapoint.metoffice.gov.uk/public/data/txt/wxfcs/regionalforecast/xml/500?key=ed47ad61-5033-48c8-bf7c-6c4c0b17c3f3

but as soon as I add the line...

$xml = simplexml_load_file('http://datapoint.metoffice.gov.uk/public/data/txt/wxfcs/regionalforecast/xml/500?key=ed47ad61-5033-48c8-bf7c-6c4c0b17c3f3');

I get and error like

namespace warning : xmlns: URI www.metoffice.gov.uk/xml/metoRegionalFcst is not absolute

I can't seem to work out how to get around this problem.

like image 463
user2227359 Avatar asked Aug 22 '14 18:08

user2227359


1 Answers

just add @ before simplexml_load_file

like

$xml = @simplexml_load_file('http://datapoint.metoffice.gov.uk/public/data/txt/wxfcs/regionalforecast/xml/500?key=ed47ad61-5033-48c8-bf7c-6c4c0b17c3f3');

like image 75
Ganesh Avatar answered Nov 08 '22 04:11

Ganesh