Jump to content

Recommended Posts

Hi,

I'm trying to get weather from google. it is working fine on my local machine. but when i make the page live it starts giving error as follow:

 

Warning: simplexml_load_file(): http:// wrapper is disabled in the server configuration by allow_url_fopen=0 in /vhost/vhost10/d/x/b/dxbconnect.com/www/demo/weather.php on line 9 Warning: simplexml_load_file(http://www.google.com/ig/api?weather=dubai): failed to open stream: no suitable wrapper could be found in /vhost/vhost10/d/x/b/dxbconnect.com/www/demo/weather.php on line 9 Warning: simplexml_load_file(): I/O warning : failed to load external entity "http://www.google.com/ig/api?weather=dubai" in /vhost/vhost10/d/x/b/dxbconnect.com/www/demo/weather.php on line 9 Fatal error: Call to a member function xpath() on a non-object in /vhost/vhost10/d/x/b/dxbconnect.com/www/demo/weather.php on line 10

 

can anyone help please?

Link to comment
https://forums.phpfreaks.com/topic/247945-error-getting-weather/
Share on other sites

Well...like it says in the error message, allow_url_fopen is disabled in your configuration.  You need to enable it.  Go find php.ini, open it, find allow_url_fopen, and change it from a 0 to a 1.  Then restart your server.

 

If you're on a shared host, you can attempt to reset it manually, or use file_get_contents or curl to pull down the file you want, then load it into SimpleXML using another function.

 

-Dan

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.