Skip to content
Advertisement

Server configuration by allow_url_fopen=0 in

I’m getting the following error when running a script. The error message is as follows…

Warning: file_get_contents() [function.file-get-contents]: https:// wrapper is disabled in the server configuration by allow_url_fopen=0 in /home/satoship/public_html/connect.php on line 22

I know this is a server issue but what do I need to do to the server in order to get rid of the above warning?

Advertisement

Answer

If you do not have the ability to modify your php.ini file, use cURL: PHP Curl And Cookies

Here is an example function I created:

JavaScript

NOTE: In revisiting this function I noticed that I had disabled SSL checks in this code. That is generally a BAD thing even though in my particular case the site I was using it on was local and was safe. As a result I’ve modified this code to have SSL checks on by default. If for some reason you need to change that, you can simply update the value for CURLOPT_SSL_VERIFYPEER, but I wanted the code to be secure by default if someone uses this.

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement