Page 1 of 1

EC FORECAST

Posted: Sun Nov 26, 2017 3:21 pm
by iquebecs58
Hi,
since the last week, the EC forecast not working anymore...

Thanks.

Steven

Re: EC FORECAST

Posted: Sun Nov 26, 2017 6:07 pm
by BlueBear
I had the same problem, go into the settings file for the ecForecast block and change from http://etc to https://etc
Should then work!
Bill

Re: EC FORECAST

Posted: Sun Nov 26, 2017 7:48 pm
by iquebecs58
I've try that Bill and still the same result :(

Re: EC FORECAST

Posted: Sun Nov 26, 2017 7:56 pm
by BlueBear
Did you clear the cache?
If not give it a hour or so and see if it changes!

Re: EC FORECAST

Posted: Mon Nov 27, 2017 11:31 am
by iquebecs58
Hmmmmm, Empty the cache, updated to the 2.1 and still not working

Re: EC FORECAST

Posted: Mon Nov 27, 2017 12:12 pm
by Jachym
Again.... I think EC is sort of playing a game with developers. They obviously dont want anyone using their data so they change the format every few months. I posted about this in August when they changed it again. 3 months forward and here we go again...

Re: EC FORECAST

Posted: Mon Nov 27, 2017 5:40 pm
by PaulMy
I have updated to v2.3 and changed the url to
https://meteo.gc.ca/city/pages/on-137_metric_f.html and https://weather.gc.ca/city/pages/on-137_metric_e.html

also cleared the Cache.

Unfortunately the block does not work http://www.komokaweather.com/j-template/indexMobile.php

Paul

Re: EC FORECAST

Posted: Mon Nov 27, 2017 6:28 pm
by BlueBear
Strange I updated this morning and it's working here

http://www.sanfordweather.com/meteo/indexDesktop.php

Bill

Re: EC FORECAST

Posted: Mon Nov 27, 2017 8:27 pm
by Jachym
PaulMy wrote: Mon Nov 27, 2017 5:40 pm I have updated to v2.3 and changed the url to
https://meteo.gc.ca/city/pages/on-137_metric_f.html and https://weather.gc.ca/city/pages/on-137_metric_e.html

also cleared the Cache.

Unfortunately the block does not work http://www.komokaweather.com/j-template/indexMobile.php

Paul
Hi Paul,
go to the block folder via FTP, delete the content of the Cache folder. Reload your page and then look inside the file created in the cache folder, and post here the content of this file

Re: EC FORECAST

Posted: Mon Nov 27, 2017 8:45 pm
by PaulMy
Hi Jachym, sorry, been away for a couple of hours...
I have deleted cache, load page, new cache created but it was empty.
Permissions where at 705, so changed all to 777, removed cache, reload and cache was saved but still empty. Have redone a couple of times with the same result.

Paul

Re: EC FORECAST

Posted: Tue Nov 28, 2017 12:05 am
by Jachym
Hmm.... did you ever have problems with loading data from EC or loading data from HTTPS sites? One of the changes now was that they migrated to https. I remember some Canadian users had problems loading data from EC (yes absurd I know). But I cant remember if it was you in particular

Re: EC FORECAST

Posted: Tue Nov 28, 2017 12:57 am
by PaulMy
Hi Jaquim,
Going back to February 2016 v1.0, there was some problem with EC Forecast for me and other Canadian users, which you resolved. Don't recall exactly, but doubt it was https at that time. I have not had any issue since that time. Not aware of any other https issues, https://weather.gc.ca/city/pages/on-137_metric_e.html loads fine for me me.

Paul

Re: EC FORECAST

Posted: Tue Nov 28, 2017 10:11 am
by Jachym
Hmmm

the function used by this script tries both methods (file_get_contents and cURL). It tries one and if it fails, it tries the other one.

Before trying to find any issues with the script we need to determine whether it is loading something from EC or not at all, in which case Im afraid there wont be much we can do.

Create a script "test.php" and upload it to your template root folder (next to indexDesktop.php). Then try running it in a browser and see if you get any output.

The script should have the following code:

Code: Select all

require("scripts/functions.php");
$data = loadContent("https://weather.gc.ca/city/pages/on-137_metric_e.html");
echo "Loaded data:<br>".$data;

Re: EC FORECAST

Posted: Tue Nov 28, 2017 2:23 pm
by BlueBear
I wonder if it isn't a hosting issue?

The ec forecast block runs fine here and I noticed that the currentCA block isn't working on Paul page either but it does here?????

http://www.sanfordweather.com/meteo/indexDesktop.php

Jachym, I tried to run the test script you show above but could not get it to work, suspect it's just a code snippet and I'm too dumb this morning to figure out what's missing!

Re: EC FORECAST

Posted: Tue Nov 28, 2017 2:51 pm
by Jachym
Sorry, I forgot, the above code is a PHP code so it needs to be insed a php tag like this

<?php

....code....

?>

Re: EC FORECAST

Posted: Tue Nov 28, 2017 3:30 pm
by BlueBear
Interesting this is the result I get

Error, contact the developer.

Here is the contents of my test.php file

<?php

require("scripts/functions.php");
$data = loadContent("https://weather.gc.ca/city/pages/on-137_metric_e.html");
echo "Loaded data:<br>".$data;

?>

Re: EC FORECAST

Posted: Tue Nov 28, 2017 3:47 pm
by Jachym
ok I see, yes, that´s because it is not loading the footer.

Then use this instead

Code: Select all

<?php

$data = loadContent("https://weather.gc.ca/city/pages/on-137_metric_e.html",10);
echo "Loaded data:<br>".$data;

function loadContent($url,$timeout){
		$ch = curl_init();
		curl_setopt($ch, CURLOPT_HEADER, 0);
		curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
		curl_setopt($ch, CURLOPT_URL, $url);
		curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
		curl_setopt($ch, CURLOPT_USERAGENT,"Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36");
		$data = curl_exec($ch);
		curl_close($ch);

		if($data==""){
			$data = file_get_contents($url);
		}

		return $data;
	}
?>


Re: EC FORECAST

Posted: Tue Nov 28, 2017 4:03 pm
by BlueBear
That works see: http://www.sanfordweather.com/meteo/test.php

now to see if Paul gets the same resultt

Re: EC FORECAST

Posted: Tue Nov 28, 2017 4:17 pm
by PaulMy
I got this result:
Warning: file_get_contents(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed in /home/content/96/5379896/html/j-template/test.php on line 17

Warning: file_get_contents(): Failed to enable crypto in /home/content/96/5379896/html/j-template/test.php on line 17

Warning: file_get_contents(https://weather.gc.ca/city/pages/on-137_metric_e.html): failed to open stream: operation failed in /home/content/96/5379896/html/j-template/test.php on line 17
Loaded data:
Paul

Re: EC FORECAST

Posted: Tue Nov 28, 2017 4:45 pm
by Jachym
OK, so this looks like communication problem, Im afraid I will not be able to help you with this Paul

Re: EC FORECAST

Posted: Wed Nov 29, 2017 10:50 am
by iquebecs58
Jachym wrote: Mon Nov 27, 2017 12:12 pm Again.... I think EC is sort of playing a game with developers. They obviously dont want anyone using their data so they change the format every few months. I posted about this in August when they changed it again. 3 months forward and here we go again...
Just not the EC website that they are changing the format. They do so with others Government's Canada website.

I guess they are scared that the weather site could be hacked... :lol: