Hello, I am trying to pull data from an XML file (The file is called online.php tho - does that matter?) with SimpleXML but i keep getting the following error: Personally, I think this has something do to with the first line (ofcourse): It has no <?XML tag. Since it just starts with the status tag. Am I right? How will I be able to fetch the data so I can use it in PHP? Kind of desperate here. Thanks.
$filecontent = file_get_contents('http://youfile.com/online.php'); preg_match_all('|<status generated="(.*)">|',$filecontent,$all); PHP: The matches will be in $all which is an array. So do a print_r($all) and you can see exactly where the data is stored that you need.
simplexml can load strings/files where the first line is not an xml tag; the error you are getting is usually due to 'special' characters in the tag it is throwing an error on, or of course there is no closing tag / incorrect markup. How big is the xml file? Paste it if its not too big.