diff --git a/imgw_podest_sq9atk.php b/imgw_podest_sq9atk.php index 0e80a94..f61bd2b 100644 --- a/imgw_podest_sq9atk.php +++ b/imgw_podest_sq9atk.php @@ -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); }