0

We had a php script using simplexml_load_file to load an external XML file. It worked fine up until yesterday. From the troubleshooting I have done, it seems I can no longer use the external URL to load the file. I tested downloading the XML files and using the local path to the file and the script works fine.

So this works: $xml = '/home/accountname/public_html/filename.xml';

But this doesn't work anymore: $xml = 'https://www.example.com/filename.xml';

We have not made any changes to the website or script. The web host has said they haven't changed anything on the web server. But obviously something has changed.

I have checked that allow_url_fopen is on and SimpleXML is enabled. The version of php has not changed.

Any thoughts on what else I can check that may have caused this change?

Update: we did find that the external server had an expired SSL cert which was why the loading of the XML file failed. We used code from this answer as a workaround for now: https://stackoverflow.com/a/32622437/13653062

tcnolan7
  • 1
  • 2
  • Do you get any PHP errors when it fails? Have you checked [libxml_get_errors](https://www.php.net/manual/en/function.libxml-get-errors.php)? Have you tried with other XML documents, or the same XML document uploaded to a different server? Unfortunately, none of these are things we can help with directly, they're just basic debugging tips, so I'm not sure there will ever be a valid answer to your question in its current form. – IMSoP Jun 02 '20 at 08:59
  • Yes, we were able to identify the error when trying to load the XML file "Warning: fopen(): SSL operation failed with code 1. OpenSSL Error messages: SSL routines:ssl3_get_server_certificate:certificate verify failed" It seems that the issue was with the external file's server. And it's not the main SSL cert which looked fine but an additional certificate that had expired. – tcnolan7 Jun 02 '20 at 13:12

0 Answers0