WXforum.net

Web Weather => Weather Website PHP/AJAX scripting => Topic started by: youngros on March 24, 2019, 06:36:16 AM

Title: YR No Script
Post by: youngros on March 24, 2019, 06:36:16 AM
This is referring to the script by Henkka.
I have just changed server with my website, both running php 5.6 and this script no longer works.
https://mad-weather.com/yrno-forecast.php I have turned error reporting on to see the errors, of which there are a few!
Is this fixable and is it fixable for when I, eventually, get things sorted to run php 7?
Timezone is set as Atlantic/Madeira in both my php version and on the script.
Thanks.
Title: Re: YR No Script
Post by: wvdkuil on March 28, 2019, 08:37:07 AM
This is referring to the script by Henkka.
I have just changed server with my website, both running php 5.6 and this script no longer works.
https://mad-weather.com/yrno-forecast.php I have turned error reporting on to see the errors, of which there are a few!
Is this fixable and is it fixable for when I, eventually, get things sorted to run php 7?
Timezone is set as Atlantic/Madeira in both my php version and on the script.
Thanks.
Most of the messages are notices, you can skip those.
The important warning messages are the 4 which start with
Code: [Select]
Warning: file_get_contents(): https:// wrapper is disabled in the server configuration by allow_url_fopen=0 in /home/madweather/public_html/yr/scripts/yr_xmlII.php on line 149
Warning: file_get_contents(https://api.met.no/weatherapi/locationforecast/1.9/?lat=32.73704&lon=-17.18674): failed to open stream: no suitable wrapper could be found in /home/madweather/public_html/yr/scripts/yr_xmlII.php on line 149
The script can not read the data as your webserver does not allow to load external data , such as the met.no data, by using file_get_contents.

The script tries to load the data from https://api.met.no/weatherapi/locationforecast/1.9/?lat=32.73704&lon=-17.18674 and when executed in a browser, the data is retuned correctly.

You should ask your provider if and how you can alter the php.ini setting into allow_url_fopen=1. Or if they will do it for you.

Wim
Title: Re: YR No Script
Post by: youngros on March 28, 2019, 12:46:21 PM
Thank you Wim,
I was able to do this myself, phew. All working again.
Rosalind