Jump to content

SimpleXMLElement Problem


barry769

Recommended Posts

I have some code that I have been using for some time on my old server running 5.1.2.  I changed to a new server running php 5.2.6 and now it is giving me an error.

 

$xml = new SimpleXMLElement("http://www.example.com/basic/file.xml", null, true);

 

SimpleXMLElement::__construct() [<a href='simplexmlelement.--construct'>simplexmlelement.--construct</a>]: WARNING: URL fopen access in <b>/file.php</b> on line <b>25</b><br />

 

Is there a change that I don't know about that is causing this, or am I just going crazy?

Link to comment
https://forums.phpfreaks.com/topic/140340-simplexmlelement-problem/
Share on other sites

url fopen is probably disabled, with good reason to.

 

would you care to explain the reason for that?  also, what can I do to get around that issue if it really is a problem.  I need a solution for this really quick since this is a website for a customer and they are pestering me as to why its not working as well as it was before I switched servers.

"url fopen" means opening a url/file to a remote site.

 

This is bad because you can never trust a remote source, and even if you can, you never should.  That being said, you can still access remote files by using cURL.

 

cURL is easy to use, just look at the examples.  Since you're only reading a file, it should be easy to implement into your current solution.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.