dopasowanie modułu IMGW Podet do aktualnego źródła danych

pull/1/head
Paweł Ostolski 2020-08-27 17:43:46 +02:00
rodzic ee8ff06b2c
commit b919de21e9
1 zmienionych plików z 6 dodań i 3 usunięć

Wyświetl plik

@ -3,7 +3,9 @@
ini_set('max_execution_time', 1800);
function getAllIdsFromImgw () {
return json_decode(file_get_contents('http://monitor.pogodynka.pl/api/map/?category=hydro'));
$res = shell_exec("curl 'https://hydro.imgw.pl/api/map/?category=hydro' -H 'User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:79.0) Gecko/20100101 Firefox/79.0' -H 'Accept: application/json, text/javascript, */*; q=0.01' -H 'Accept-Language: pl,en-US;q=0.7,en;q=0.3' --compressed -H 'X-Requested-With: XMLHttpRequest' -H 'Connection: keep-alive' -H 'Referer: https://hydro.imgw.pl/' -H 'Cookie: SRV_=shsrv02.imgw.pl_SRV' -H 'Pragma: no-cache' -H 'Cache-Control: no-cache'");
return json_decode($res);
}
function getRequestedIds ($base64json) {
@ -41,8 +43,9 @@
if (!in_array($row->i, $requestIds)) continue;
if ( dataFileIsToOld('imgwpodest_data/'.$row->i.'.json', 3600)) {
$json = file_get_contents('http://monitor.pogodynka.pl/api/station/hydro/?id='.$row->i);
if (dataFileIsToOld('imgwpodest_data/'.$row->i.'.json', 3600)) {
$json = shell_exec("curl 'https://hydro.imgw.pl/api/station/hydro/?id=".$row->i."' -H 'User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:79.0) Gecko/20100101 Firefox/79.0' -H 'Accept: application/json, text/javascript, */*; q=0.01' -H 'Accept-Language: pl,en-US;q=0.7,en;q=0.3' --compressed -H 'X-Requested-With: XMLHttpRequest' -H 'Connection: keep-alive' -H 'Referer: https://hydro.imgw.pl/' -H 'Cookie: SRV_=shsrv01.imgw.pl_SRV' -H 'Pragma: no-cache' -H 'Cache-Control: no-cache'");
file_put_contents('imgwpodest_data/'.$row->i.'.json', $json);
}