Page 1 of 1

warningsau

Posted: Thu Sep 13, 2018 12:21 pm
by tpweather
Hi All
Anyone else who is warningsau having errors?
Mine is giving an error which can be viewed here:
www.tpweather.com.au
Many thanks in advance.
Chris

Re: warningsau

Posted: Fri Sep 14, 2018 3:23 am
by John B
Yes, Chris..

The Australian conditions block, too.

Both return the 'Data unavailable' message.

AS it happens they are both in the same menu block. I don't think that's the problem as another block is not affected.

I suspect that it's either a BoM problem or it has altered some of its data formats.

Regards,

John

P.S. - The link you posted does not work.

Re: warningsau

Posted: Sat Sep 15, 2018 1:56 am
by tpweather
Thanks John. I have fixed the link.

Re: warningsau

Posted: Sat Sep 15, 2018 11:47 pm
by stuee
Hi.
Im having this same issue on both the blocks, how did you fix it?

Thanks

Re: warningsau

Posted: Sun Sep 16, 2018 7:02 am
by John B
No, stuee, Chris merely mentioned that the incorrect link to his site had been adjusted.

Re: warningsau

Posted: Mon Oct 08, 2018 2:33 am
by tpweather
Hi All
Anyone figure this out yet? I've tried playing around with it no luck.
Cheers
Chris

Re: warningsau

Posted: Tue Oct 23, 2018 2:54 am
by Aussie Susan
I had a very similar problem with one of the skins for weewx - it turns out that the BoM requires a "User-Agent" entry in the HTTP header that retrieves the data.

NOTE: USE THE FOLLOWING AT YOUR OWN RISK

I edited the 'currentAustraliaBlockLoader.php' file at around line 64 to change:

Code: Select all

$html = file_get_context($url);
to be:

Code: Select all

$opts = [
    "http" => [
        "method" => "GET",
        "header" => "User-Agent: Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36"
        ]
    ];
$context = stream_context_create($opts);
$html = file_get_contents($url, false, $context);
I have no idea if you need all that text in the 'User-Agent' line but I copied that from somewhere a while ago and it works. Experiment if you like.

I suggest that you backup the file before editing it.

Also the location of the file probably depends on where you installed Meteotemplate but for me it was in the subdirectory meteotemplate/homepage/blocks/currentAustralia.

Susan

Re: warningsau

Posted: Sat Nov 03, 2018 12:06 pm
by tpweather
Thanks Susan, but where do I find currentAustraliaBlockLoader.php? It's not in the warningsAU block folder

Re: warningsau

Posted: Thu Nov 29, 2018 9:33 pm
by Aussie Susan
@tpweather - sorry but I've only just seen your message.

I gave the location where the file was on my system. I suggest that you grep for 'file_get_contents' and see which one(s) are in an appropriate place and probably look something like '"$html = file_get_contents($url)".

By the way, I see in my post above I incorrectly typed the code I altered: it was not 'file_get_context' but 'file_get_contents'. The replacement code is correct though.

Susan

Re: warningsau

Posted: Fri Nov 30, 2018 1:52 pm
by tpweather
Yup thanks Susan. I realise that now. sorry, I am talking about the warningsAU block. I do not use the Australia
Current Conditions block, hence my confusion! I'm really keen to get the warningsAU block up and running if you have any suggestions?? :D

Re: warningsau

Posted: Sun Dec 02, 2018 5:41 pm
by Jachym
It looks like several AU blocks stopped functioning due to changes in data source

Re: warningsau

Posted: Sun Dec 09, 2018 8:45 am
by Jachym
Update available for both current conditions and warnings

Re: warningsau

Posted: Sun Dec 09, 2018 10:27 pm
by John B
Thanks, Jáchym, your time and trouble are very much appreciated. 8-)

Re: warningsau

Posted: Mon Dec 31, 2018 7:29 am
by tpweather
many thanks Jachym. Happy New Year