Страница 17 из 22

Re: Модуль "Погода от Яндекс"

Добавлено: Ср фев 08, 2017 5:37 pm
ahelper
Приветствую. Только начинаю все изучать. Создал сценарий погоды от Яндекса с кодом
SPOILERSPOILER_SHOW
//Тест разбора погоды от Яндекса
$data_file="https://export.yandex.ru/bar/reginfo.xm ... xml?".rand(); // адрес xml файла

$xml = simplexml_load_file($data_file); // раскладываем xml на массив


sg("PogodaYavObn.City",$xml->weather->day->title);
sg("PogodaYavObn.Country",$xml->weather->day->country);
sg("PogodaYavObn.SunRise",$xml->weather->day->sun_rise);
sg("PogodaYavObn.SunSet",$xml->weather->day->sunset);

sg("PogodaYavObn.Type",$xml->weather->day->day_part->weather_type);
sg("PogodaYavObn.Code",$xml->weather->day->day_part->weather_code);
sg("PogodaYavObn.WindSpeed",$xml->weather->day->day_part->wind_speed);
sg("PogodaYavObn.WindDir",$xml->weather->day->day_part->wind_direction);
sg("PogodaYavObn.Humidity",$xml->weather->day->day_part->dampness);
sg("PogodaYavObn.Hectopascal",$xml->weather->day->day_part->hectopascal);
sg("PogodaYavObn.Torr",$xml->weather->day->day_part->torr);
sg("PogodaYavObn.Pressure",$xml->weather->day->day_part->pressure);
sg("PogodaYavObn.Temp",$xml->weather->day->day_part->temperature);
sg("PogodaYavObn.Observ_time",$xml->weather->day->day_part->observation_time);
//sg("PogodaYavObn.Image",$xml->weather->day->day_part->image-v3);
sg("PogodaYavObn.Image",$xml->weather->day->day_part->image);
Подскажите пожалуйста, как мне извлечь картинку с предпоследней закомментированой строки?
Код XML страницы выглядит так
SPOILERSPOILER_SHOW
<day_part typeid="2" type="день">
<weather_type>переменная облачность</weather_type>
<weather_code>partly-cloudy</weather_code>
<image>
https://yastatic.net/weather/i/icons/bl ... /bkn_d.png
</image>
<image-v2 size="22x22">
http://yandex.st/weather/v-1/i/icons/22 ... _d_-12.png
</image-v2>
<image-v3 size="48">
https://yastatic.net/weather/i/icons/bl ... /bkn_d.png
</image-v3>

Re: Модуль "Погода от Яндекс"

Добавлено: Чт фев 09, 2017 9:03 am
nick7zmail
ahelper писал(а): Подскажите пожалуйста, как мне извлечь картинку с предпоследней закомментированой строки?
Код XML страницы выглядит так
SPOILERSPOILER_SHOW
<day_part typeid="2" type="день">
<weather_type>переменная облачность</weather_type>
<weather_code>partly-cloudy</weather_code>
<image>
https://yastatic.net/weather/i/icons/bl ... /bkn_d.png
</image>
<image-v2 size="22x22">
http://yandex.st/weather/v-1/i/icons/22 ... _d_-12.png
</image-v2>
<image-v3 size="48">
https://yastatic.net/weather/i/icons/bl ... /bkn_d.png
</image-v3>
В значение скорее всего попадает что-то типа (в данном случае) bkn_d....чтобы вывести это на сцену/в какой либо элемент - нужно примерно следующее...вставляем, как обычную картинку, только имя заменяем на свойство...как то так

Код: Выделить всё

<img src="https://yastatic.net/weather/i/icons/blueye/48/%PogodaYavObn.Image%.png"> 

Re: Модуль "Погода от Яндекс"

Добавлено: Вс фев 19, 2017 7:32 am
directman66
кстати, неплохо забирается погода с сайте GISMETEO через web-переменные

примеры настроек:

gismeteo pressure
http://m.gismeteo.com/weather/13056/current/
<p>Pressure:(.+?)mmHg<\/p>


ветер
http://m.gismeteo.ru/weather/13056/current/
<p>Ветер:(.+?)<\/p>

gismeteo Humidity
http://m.gismeteo.com/weather/13056/current/

Re: Модуль "Погода от Яндекс"

Добавлено: Вс фев 19, 2017 9:15 am
dioxin
А самое главное не вытащил, температуру))
Текущую температуру можно и со своего датчика брать, что несомненно точней.

Re: Модуль "Погода от Яндекс"

Добавлено: Вс фев 19, 2017 5:45 pm
directman66
Температуру я тоже беру, просто не указана. В примере.

Re: Модуль "Погода от Яндекс"

Добавлено: Вт фев 21, 2017 8:24 pm
Denzot
Доброе время суток!
ребята, подскажите как исправить ошибку:
КОД ОШИБКИ МОДУЛЯ

Код: Выделить всё

Warning: simplexml_load_file(): entNS";f="firstChild";w="http://www.w3.org/2000/svg";e[c]+=" i-ua_svg_"+(!!d[n]& in C:\_majordomo\htdocs\modules\app_yaweather\app_yaweather.class.php on line 246

Warning: simplexml_load_file(): ^ in C:\_majordomo\htdocs\modules\app_yaweather\app_yaweather.class.php on line 246

Warning: simplexml_load_file(): http://pogoda.yandex.ru/weather-ng/forecasts/35394.xml:1: parser error : xmlParseEntityRef: no name in C:\_majordomo\htdocs\modules\app_yaweather\app_yaweather.class.php on line 246

Warning: simplexml_load_file(): ntNS";f="firstChild";w="http://www.w3.org/2000/svg";e[c]+=" i-ua_svg_"+(!!d[n]&& in C:\_majordomo\htdocs\modules\app_yaweather\app_yaweather.class.php on line 246

Warning: simplexml_load_file(): ^ in C:\_majordomo\htdocs\modules\app_yaweather\app_yaweather.class.php on line 246

Warning: simplexml_load_file(): http://pogoda.yandex.ru/weather-ng/forecasts/35394.xml:1: parser error : xmlParseEntityRef: no name in C:\_majordomo\htdocs\modules\app_yaweather\app_yaweather.class.php on line 246

Warning: simplexml_load_file(): );v=d.createElement("div");v.innerHTML="<svg/>";e[c]+=" i-ua_inlinesvg_"+((v[f]& in C:\_majordomo\htdocs\modules\app_yaweather\app_yaweather.class.php on line 246

Warning: simplexml_load_file(): ^ in C:\_majordomo\htdocs\modules\app_yaweather\app_yaweather.class.php on line 246

Warning: simplexml_load_file(): http://pogoda.yandex.ru/weather-ng/forecasts/35394.xml:1: parser error : EntityRef: expecting ';' in C:\_majordomo\htdocs\modules\app_yaweather\app_yaweather.class.php on line 246

Warning: simplexml_load_file(): v=d.createElement("div");v.innerHTML="<svg/>";e[c]+=" i-ua_inlinesvg_"+((v[f]&&v in C:\_majordomo\htdocs\modules\app_yaweather\app_yaweather.class.php on line 246

Warning: simplexml_load_file(): ^ in C:\_majordomo\htdocs\modules\app_yaweather\app_yaweather.class.php on line 246

Warning: simplexml_load_file(): http://pogoda.yandex.ru/weather-ng/forecasts/35394.xml:1: parser error : xmlParseEntityRef: no name in C:\_majordomo\htdocs\modules\app_yaweather\app_yaweather.class.php on line 246

Warning: simplexml_load_file(): dow).width();params.blockId=w>1200?"R-I-49688-8":"R-I-49688-32";params.onRender& in C:\_majordomo\htdocs\modules\app_yaweather\app_yaweather.class.php on line 246

Warning: simplexml_load_file(): ^ in C:\_majordomo\htdocs\modules\app_yaweather\app_yaweather.class.php on line 246

Warning: simplexml_load_file(): http://pogoda.yandex.ru/weather-ng/forecasts/35394.xml:1: parser error : xmlParseEntityRef: no name in C:\_majordomo\htdocs\modules\app_yaweather\app_yaweather.class.php on line 246

Warning: simplexml_load_file(): ow).width();params.blockId=w>1200?"R-I-49688-8":"R-I-49688-32";params.onRender&& in C:\_majordomo\htdocs\modules\app_yaweather\app_yaweather.class.php on line 246

Warning: simplexml_load_file(): ^ in C:\_majordomo\htdocs\modules\app_yaweather\app_yaweather.class.php on line 246

Warning: simplexml_load_file(): http://pogoda.yandex.ru/weather-ng/forecasts/35394.xml:1: parser error : Opening and ending tag mismatch: br line 1 and p in C:\_majordomo\htdocs\modules\app_yaweather\app_yaweather.class.php on line 246

Warning: simplexml_load_file(): ooting.xml'>поделитесь ею с нами</a>, пожалуйста.</p> in C:\_majordomo\htdocs\modules\app_yaweather\app_yaweather.class.php on line 246

Warning: simplexml_load_file(): ^ in C:\_majordomo\htdocs\modules\app_yaweather\app_yaweather.class.php on line 246

Warning: simplexml_load_file(): http://pogoda.yandex.ru/weather-ng/forecasts/35394.xml:1: parser error : Opening and ending tag mismatch: br line 1 and div in C:\_majordomo\htdocs\modules\app_yaweather\app_yaweather.class.php on line 246

Warning: simplexml_load_file(): " href="/pogoda/astana">Астана</a></li></ul></div></div></div></div></div> in C:\_majordomo\htdocs\modules\app_yaweather\app_yaweather.class.php on line 246

Warning: simplexml_load_file(): ^ in C:\_majordomo\htdocs\modules\app_yaweather\app_yaweather.class.php on line 246

Warning: simplexml_load_file(): http://pogoda.yandex.ru/weather-ng/forecasts/35394.xml:1: parser error : xmlParseEntityRef: no name in C:\_majordomo\htdocs\modules\app_yaweather\app_yaweather.class.php on line 246

Warning: simplexml_load_file(): </script><script nonce="01d411483a741aa7598f8aa8edb73eea">Boolean(window.Atom) & in C:\_majordomo\htdocs\modules\app_yaweather\app_yaweather.class.php on line 246

Warning: simplexml_load_file(): ^ in C:\_majordomo\htdocs\modules\app_yaweather\app_yaweather.class.php on line 246

Warning: simplexml_load_file(): http://pogoda.yandex.ru/weather-ng/forecasts/35394.xml:1: parser error : xmlParseEntityRef: no name in C:\_majordomo\htdocs\modules\app_yaweather\app_yaweather.class.php on line 246

Warning: simplexml_load_file(): /script><script nonce="01d411483a741aa7598f8aa8edb73eea">Boolean(window.Atom) && in C:\_majordomo\htdocs\modules\app_yaweather\app_yaweather.class.php on line 246

Warning: simplexml_load_file(): ^ in C:\_majordomo\htdocs\modules\app_yaweather\app_yaweather.class.php on line 246

Warning: simplexml_load_file(): http://pogoda.yandex.ru/weather-ng/forecasts/35394.xml:1: parser error : Opening and ending tag mismatch: br line 1 and body in C:\_majordomo\htdocs\modules\app_yaweather\app_yaweather.class.php on line 246

Warning: simplexml_load_file(): quot;show","path":"weather_web.header"}]}}"></i></body> in C:\_majordomo\htdocs\modules\app_yaweather\app_yaweather.class.php on line 246

Warning: simplexml_load_file(): ^ in C:\_majordomo\htdocs\modules\app_yaweather\app_yaweather.class.php on line 246

Warning: simplexml_load_file(): http://pogoda.yandex.ru/weather-ng/forecasts/35394.xml:1: parser error : Opening and ending tag mismatch: p line 1 and html in C:\_majordomo\htdocs\modules\app_yaweather\app_yaweather.class.php on line 246

Warning: simplexml_load_file(): ow","path":"weather_web.header"}]}}"></i></body></html> in C:\_majordomo\htdocs\modules\app_yaweather\app_yaweather.class.php on line 246

Warning: simplexml_load_file(): ^ in C:\_majordomo\htdocs\modules\app_yaweather\app_yaweather.class.php on line 246

Warning: simplexml_load_file(): http://pogoda.yandex.ru/weather-ng/forecasts/35394.xml:1: parser error : Premature end of data in tag div line 1 in C:\_majordomo\htdocs\modules\app_yaweather\app_yaweather.class.php on line 246

Warning: simplexml_load_file(): ow","path":"weather_web.header"}]}}"></i></body></html> in C:\_majordomo\htdocs\modules\app_yaweather\app_yaweather.class.php on line 246

Warning: simplexml_load_file(): ^ in C:\_majordomo\htdocs\modules\app_yaweather\app_yaweather.class.php on line 246

Warning: simplexml_load_file(): http://pogoda.yandex.ru/weather-ng/forecasts/35394.xml:1: parser error : Premature end of data in tag body line 1 in C:\_majordomo\htdocs\modules\app_yaweather\app_yaweather.class.php on line 246

Warning: simplexml_load_file(): ow","path":"weather_web.header"}]}}"></i></body></html> in C:\_majordomo\htdocs\modules\app_yaweather\app_yaweather.class.php on line 246

Warning: simplexml_load_file(): ^ in C:\_majordomo\htdocs\modules\app_yaweather\app_yaweather.class.php on line 246

Warning: simplexml_load_file(): http://pogoda.yandex.ru/weather-ng/forecasts/35394.xml:1: parser error : Premature end of data in tag html line 1 in C:\_majordomo\htdocs\modules\app_yaweather\app_yaweather.class.php on line 246

Warning: simplexml_load_file(): ow","path":"weather_web.header"}]}}"></i></body></html> in C:\_majordomo\htdocs\modules\app_yaweather\app_yaweather.class.php on line 246

Warning: simplexml_load_file(): ^ in C:\_majordomo\htdocs\modules\app_yaweather\app_yaweather.class.php on line 246

Warning: Invalid argument supplied for foreach() in C:\_majordomo\htdocs\modules\app_yaweather\app_yaweather.class.php on line 280
 MajorDoMo


подскажите пожалуйста что не так почему не работает модкль?

Re: Модуль "Погода от Яндекс"

Добавлено: Вт фев 21, 2017 8:29 pm
dioxin
http://pogoda.yandex.ru/weather-ng/forecasts/35394.xml такого файла просто нет на яндексе. Отсюда и ошибки парсинга.

directman66 - как температуру вытащил? Покажи плиз.

Re: Модуль "Погода от Яндекс"

Добавлено: Вт фев 21, 2017 8:58 pm
Tem
dioxin писал(а):directman66 - как температуру вытащил? Покажи плиз.
Просто текущую ?
<td class="weather__temp"><span>(.+?)<\/span><\/td>

Re: Модуль "Погода от Яндекс"

Добавлено: Вт фев 21, 2017 9:00 pm
Denzot
[quote="dioxin"]http://pogoda.yandex.ru/weather-ng/forecasts/35394.xml такого файла просто нет на яндексе. Отсюда ошибки и парсинга.

подскажите как исправить ошибку

Re: Модуль "Погода от Яндекс"

Добавлено: Вт фев 21, 2017 9:17 pm
DimSun75
Denzot писал(а):
dioxin писал(а):http://pogoda.yandex.ru/weather-ng/forecasts/35394.xml такого файла просто нет на яндексе. Отсюда ошибки и парсинга.

подскажите как исправить ошибку
Переписать модуль или договориться с яндексом