How to create XML reader from the URL XML data?
I provide valid XML data from a URL to the PHPExcel factory's identify() but the script fires an error:
( ! ) Fatal error: Uncaught exception 'PHPExcel_Reader_Exception' with message ' in C:\wamp\www\project\Classes\PHPExcel\Reader\Excel2007.php on line 82
( ! ) PHPExcel_Reader_Exception: Could not open for reading! File does not exist. in C:\wamp\www\project\Classes\PHPExcel\Reader\Excel2007.php on line 82
$url = "http://www.w3schools.com/xml/note.xml";
$xml = simplexml_load_file($url); //OR $xml = simplexml_load_string(file_get_contents($url));
$inputFileType = PHPExcel_IOFactory::identify($xml); // ERROR
UPDATE:
$dom = new DOMDocument();
$dom->load($url);
$fileName = 'filename.xml';
$xml = $dom->save($fileName);
$inputFileType = PHPExcel_IOFactory::identify($xml);
( ! )Fatal error: Uncaught exception 'PHPExcel_Reader_Exception' with message 'Could not open 116752 for reading! File does not exist.' in C:\wamp\www\project\Classes\PHPExcel\Reader\Excel2007.php on line 82
( ! ) PHPExcel_Reader_Exception: Could not open 116752 for reading! File does not exist.
identify(). I'll try saving it as Excel now. What I want to do is basically grab that XML from URL, save it as XML file on server(because PHPExcel seems to be not able to read data from URLs, then open that locally saved XML and save it as Excel). Seems kind of unnecessary complex, but I think that's because of PHPExcel's shortfalling(I'm not sure, maybe there's a way to read XML from URL right intoidentify)