Jump to content

error getting weather


delickate

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

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.