Will Will - 11 months ago 36
PHP Question

How to open an xml file, in php using XMLReader, and using an https address?

I am trying to open an XML file that is in a https address. I can see the XML file from my browser, and there are no log ins. I am trying to use the XMLReader object in PHP, and I can't seem to get the file through the open method. It returns false. I can't seem to find any errors in the apache log other than complaints about using the next function when the open function didn't work.

This is my corresponding code with an example url:

$xml_url = 'https://www.example.com/test.xml'
$read = new XMLReader;
if (!$read->open($xml_url)) {
echo "bad open";


If you want to use an HTTPS url you have to make sure that the openssl extension is activated in PHP



or if you are unix