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:wampwwwprojectClassesPHPExcelReaderExcel2007.php on line 82
( ! ) PHPExcel_Reader_Exception: Could not open for reading! File does not exist. in C:wampwwwprojectClassesPHPExcelReaderExcel2007.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);
See Question&Answers more detail:os( ! )Fatal error: Uncaught exception 'PHPExcel_Reader_Exception' with message 'Could not open 116752 for reading! File does not exist.' in C:wampwwwprojectClassesPHPExcelReaderExcel2007.php on line 82
( ! ) PHPExcel_Reader_Exception: Could not open 116752 for reading! File does not exist.