Здравствуйте, имеется скрипт парсер погоды от яндекса:
С недавнего времени он работать перестал, вероятно яндекс погода заблочило мой айпи хостинга ... не могу понять почему
Возможно версия php на хостинге например изменилась..
<?php
$city_id = 28666; //id гоÑ
од
а, впÐ
¸ÑаÑ
;Ñ ÑвÐ
¾Ð¹, моÐ
¶Ð½Ð¾ Ñзн
;аÑÑ
0; ÑÑÑ
https://p...content-available-to-author-only..
.x.ru/static/cities.xml - паÑ
;аме
09;Ñ city id=
$cache_lifetime = 7200; //вÑ
8;µÐ¼Ñ кÑÑ
а Ñай
;ла в Ñек
;ÑнÐ
;´Ð°Ñ
, 3600=1 ÑаÑ
;
$cache_file = 'weather_'.$city_id.'.xml'; // вÑÐ
µÐ¼ÐµÐ
9;нÑ
8;¹ Ñай
;л-кÑ
41;Ñ
function loadxmlyansex($city_id)
{
$url = 'http://e...content-available-to-author-on
ly...x.ru/weather-ng/forecasts/'.$city_id.'
;.xml';
$userAgent = 'Googlebot/2.1 (+http://www.google.com/bot.html)'
;
$xml = 'weather_'.$city_id.'.xml';
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_BINARYTRANSFER, true);
curl_setopt($ch, CURLOPT_USERAGENT, $userAgent);
$output = curl_exec($ch);
$fh = fopen($xml, 'w');
fwrite($fh, $output);
fclose($fh);
}
if ( file_exists($cache_file) ) {
$cache_modified = time() - @filemtime($cache_file);
if ( $cache_modified > $cache_lifetime )
{
//обÐ
89;ов
08;»ÑеÐ&
#188; Ñай
;л поÐ
³Ð¾Ð´
Ñ, еÑл
8;¸ вÑÐ
µÐ¼Ñ Ñай
;ла кÑÑ
а ÑÑÑ
аÑÐ
;µÐ»Ð¾
loadxmlyansex($city_id);
}
}
else {
//еÑл
208;¸ неÑ
; Ñай
;ла поÐ
³Ð¾Ð´
Ñ Ð²Ð¾Ð
¾Ð±ÑÐ
;µ, зак
8;°Ñи
08;²Ð°ÐµÐ&
#188; его
;
loadxmlyansex($city_id);
}
?>
<?php
if(file_exists($cache_file)):
$data = simplexml_load_file($cache_file); ?>