Problem with Meteoalarm

Good morning.
I have a problem with the meteoalarm. They stopped working after moving to a new server.
We had a yellow alert yesterday and nothing showed up.
My code: PL2417
Silesian Province Zywiecki County.
My website: http://www.pogodawmilowce.pl/pws.
Paul

Use the debug console and click top-left selector, it is already for advisory_c_small.php
The results in the large block, it will show the results, similar to Niebo rozpogodzi się w nocy. Min. temp. -7 °C . . . .
Right click, select show source or show html, depends on your browser.
Check the html =>
advisory_c_small.php (25) version =>advisory_c_small.php|01|2021-06-18|
advisory_c_small.php (34) include_once =>PWS_livedata.php
PWS_livedata.php (22) version =>PWS_livedata.php|01|2022-03-28|
PWS_livedata.php (25) include_once =>PWS_settings.php
PWS_settings.php (28) version =>PWS_settings.php|01|2022-12-23|
PWS_settings.php (32) include =>/home/srv47052/domains/pogodawmilowce.pl/public_html/pws/_my_settings/settings.php
PWS_settings.php (176) $defaultlanguage=pl $used_lang =pl $locale_wu=pl-PL $lang_locale=pl $lang_file=languages/lang_pl.txt
PWS_settings.php (284) $units_used =metric $windunit=km/h $tempunit=C $rainunit=mm $pressureunit=hPa $distanceunit=km $wu_unit=m
PWS_livedata.php (29) include_once =>PWS_shared.php
PWS_shared.php (21) version =>PWS_shared.php|01|2021-12-04|
PWS_livedata.php (39) $itsday =
wrnWarningEU-CAP.php(35) loaded =>wrnWarningEU-CAP.php|01|2021-08-16|
wrnWarningEU-CAP.php (40) include_once =>PWS_livedata.php
wrnWarningEU-CAP.php (122) areas=PL2417 countries=PL
wrnWarningEU-CAP.php (442) PL_warnings: time spent: 10.0009 - invalid CURL
Connection timed out after 10000 milliseconds [color=red]https://hub.meteoalarm.org/api/v1/stream-buffers/feeds-poland/warnings?include_geocodes=0&exclude_severity_minor=1[/color]
wrnWarningEU-CAP.php(151) invalid data load

The new server can not communicate with the meteoalarm server.
Seems to be a DNS problem?
You can click the link in the text above and you will see that there is a large file loaded in your browser within 1-2 seconds.

First check with your provider why CURL is not allowed to access the meteoalarm website.
I will do a few tests myself tomorrow.

Wim


Thanks :smiley:
The provider wrote:
"The problem looks at the target operator.
[root@h26 ~]# host -t A meteoalarm.org
meteoalarm.org has address 138.22.100.87
[root@h26 ~]#

[root@h26 ~]# mtr -c 5 -r -n 138.22.100.87
Start: 2023-01-29T19:24:59+0100
HOST: h26.seohost.pl Loss% Snt Last Avg Best Wrst StDev
1.|-- 83.150.236.2 0.0% 5 0.5 2.5 0.5 9.8 4.1
2.|-- 91.204.161.60 0.0% 5 0.6 0.9 0.3 2.5 0.9
3.|-- 91.236.52.255 0.0% 5 0.5 0.5 0.4 0.6 0.1
4.|-- 195.182.218.197 40.0% 5 9.0 7.5 6.3 9.0 1.4
5.|-- ??? 100.0 5 0.0 0.0 0.0 0.0 0.0
6.|-- 184.104.204.222 0.0% 5 16.3 16.2 16.1 16.3 0.0
7.|-- 193.171.13.245 40.0% 5 18.5 18.5 18.5 18.6 0.1
8.|-- ??? 100.0 5 0.0 0.0 0.0 0.0 0.0
[root@h26 ~]# host 195.182.218.197
197.218.182.195.in-addr.arpa domain name pointer henet.plix.pl.
[root@h26 ~]# host 193.171.13.245
245.13.171.193.in-addr.arpa domain name pointer wien1.aco.net.
[root@h26 ~]#
Packet losses are at the very end of the destination routing, they go out correctly from our server room. The weather alarm operator should check the routing from himself and report it to his ISP."

Translated by google.

Sadly they did not understand that it is their problem.
The DNS is not resolved or they do not allow redirects.
I changed my testsite TEST TEST Home Weather Station (ecoLcl version) to your PL2417 area, currently there is no warning for that area. You can check it in the menu if there are errors TEST TEST Official weather alarms

I attached a small test script to test further…
Unzip the attachment and upload the script test_curl3.php to your http://www.pogodawmilowce.pl/pws/ folder

When you run it in your browser http://www.pogodawmilowce.pl/pws/test_curl3.php you will see
[size=66][font=courier][b]The link tested for: meteoalarm1 is https://hub.meteoalarm.org/api/v1/stream-buffers/feeds-poland/warnings?include_geocodes=0&exclude_severity_minor=1[/b][/font][/size]
followed by a box with the output in an iframe => so your browser succeeded to connect to the meteoalarm website
a large chunk of debug information, with a redirect 301 to the new URL
Data returned (maximum first 500 characters displayed)
In there there should be HTTP/1.1 200 OK

[size=66][font=courier]HTTP/1.1 301 Moved Permanently
cache-control: max-age=0, private, must-revalidate
content-length: 123
content-type: text/html; charset=utf-8
date: Sun, 29 Jan 2023 20:06:43 GMT
location: https://feeds.meteoalarm.org/api/v1/warnings/feeds-poland
server: Cowboy
x-request-id: Fz7gXZt1BbC8I94B6NVD

HTTP/1.1 200 OK
cache-control: max-age=0, private, must-revalidate
content-length: 1411029
content-type: application/json; charset=utf-8
date: Sun, 29 Jan 2023 20:06:43 GMT
server: Cowboy[/font][/size]

====
The second part starts with
[size=66][font=courier][b]The link tested for: meteoalarm2 is https://feeds.meteoalarm.org/api/v1/warnings/feeds-poland?include_geocodes=0&exclude_severity_minor=1[/b][/font][/size]

That one should work OK for you if it is a redirect problem, or a 10 seconds timeout and no data if it is their dns server.

I will check if you mail / post when you uploaded the test-script.

Wim


test_curl3.php.zip (2.6 KB)

Well you can tell your support-persons to test the link themselves.
The DNS is not resolved or the webservers communication blocks / is blocked between your webserver and the meteoalarn server.

That is IMHO not a problem with your site, but with the providers server.

Did it worked before with another provider?

Wim

I uploaded this file to the server.

Yes it worked, I had no problems

See my last post just before yours.
I have access to 12 different servers, and all allow the test_curl3.php script to work.
Even the least expensive ones of 0,45 or 1 euro/month.
This is how it should look on their site also => http://testing4ever.nl/test_curl3.php

Wim

I got a response from support-persons:
"The verse below the given link says that it failed to download data from the given link because the connection timed out. The solution can be to extend this time by adding:
set_time_limit(0); //A setting for the entire script
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 0);
curl_setopt($ch, CURLOPT_TIMEOUT, 400); //seconds "

Pawel

No, that is not a solution.
All tested webservers, a few hundred users, get the information back in less then 5 seconds.
That is why the time is set at double that max time.

A CONNECTTIMEOUT of infinite seconds is not the correct way and will not solve it.

But I am willing to learn already for a long time. Hope your support person is also.
Just add those two lines between line 71 and 72.
They should look like

    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
    curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 0);
    curl_setopt($ch, CURLOPT_TIMEOUT, 400); //seconds "
    $rawData = curl_exec ($ch);

Just wonder what the advantage was for you to switching to this provider.
Maybe your provider could contact meteoalarm.org provider to discuss this.
It is not our profession, we want to run a website.

Support persons should talk to each other to solve this.

Wim

P.S. PHP: curl_setopt - Manual
CURLOPT_CONNECTTIMEOUT The number of seconds to wait while trying to connect. Use 0 to wait indefinitely.

Well, you got me thinking…
Thank you for your time.