I have written simple code to get content from xml file to php.
$xml = simplexml_load_file("http://localhost/xml_load/test_xml.xml");
print_r($xml);
First time It has run successfully but right now it is giving me warning and not executing properly.
Warning: simplexml_load_file(http://localhost/xml_load/test_xml.xml) [function.simplexml-load-file]: failed to open stream: HTTP request failed! <?xml version="1.0" encoding="ISO-8859-1"?> in C:\xampp\htdocs\XML_load\load_file.php on line 2
Warning: simplexml_load_file() [function.simplexml-load-file]: I/O warning : failed to load external entity "http://localhost/xml_load/test_xml.xml" in C:\xampp\htdocs\XML_load\load_file.php on line 2
No file found on your respective location. Now, either check if your file exist. However, do try to make your local path doesn't based over BASEURL. Add that path further like
$xml = simplexml_load_file("xml/files/myxml.xml"); // PATH TO YOUR FILE.
echo "<pre>"; print_r($xml); "</pre>";
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.