2

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";
}
2
  • 2
    As its an https address you may need to make sure that the openssl extension is enabled in PHP Commented Apr 15, 2016 at 22:54
  • That was the problem! Commented Apr 15, 2016 at 23:08

1 Answer 1

2

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

php.ini

extension=php_openssl.dll

or if you are unix

extension=php_openssl.so
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.