PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
If I run this when the url is unavailable I get "file doesn't exist", but I can't figure out how to call this file without a parsing error if the file is unavailable.
Warning: simplexml_load_file() [function.simplexml-load-file]: http://localhost/scripts/pricefeed.php:1: parser error : Start tag expected, '<' not found in C:\xampp\htdocs\prices.php on line 17
If I get rid of the "file exists" echoes from the pricefeed.php file I get
Document is empty in C:\xampp\htdocs\prices.php on line 17
Im not sure exactly what you are suggesting here, but I should probably mention that my script works fine if the website hosting the xml file is up.
I just want some redundancy if the site I am getting the xml prices from goes down.
Warning: simplexml_load_file() [function.simplexml-load-file]: http://localhost/scripts/pricefeed.php:1: parser error : Start tag expected, '<' not found in C:\xampp\htdocs\prices.php on line 17
This error is suggesting the file pricefeed.php is not a valid xml document. Because it could not find the opening tag.
Warning: simplexml_load_file() [function.simplexml-load-file]: scripts/pricefeed.php:18: parser error : Start tag expected, '<' not found in C:\xampp\htdocs\wpgoldprices.php on line 18
Warning: simplexml_load_file() [function.simplexml-load-file]: ?> in C:\xampp\htdocs\wpgoldprices.php on line 18
Warning: simplexml_load_file() [function.simplexml-load-file]: ^ in C:\xampp\htdocs\wpgoldprices.php on line 18
Warning: SimpleXMLElement::__construct() [function.SimpleXMLElement---construct]: Entity: line 1: parser error : Start tag expected, '<' not found in C:\xampp\htdocs\wpgoldprices.php on line 17
Warning: SimpleXMLElement::__construct() [function.SimpleXMLElement---construct]: scripts/pricefeed.php in C:\xampp\htdocs\wpgoldprices.php on line 17
Warning: SimpleXMLElement::__construct() [function.SimpleXMLElement---construct]: ^ in C:\xampp\htdocs\wpgoldprices.php on line 17 Caught exception: String could not be parsed as XML