"PHP" / Говнокод #16303 Ссылка на оригинал

0

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 8
  9. 9
  10. 10
  11. 11
  12. 12
  13. 13
$pogoda = file_get_contents('http://export.yandex.ru/weather/');
    preg_match('/<weather_type>(.*?)<\/weather_type>/i',$pogoda,$type);
    preg_match('/<dampness>(.*?)<\/dampness>/i',$pogoda,$vlaga);
    preg_match('/<temperature>(.*?)<\/temperature>/i',$pogoda,$temp);
    preg_match('/<image2>(.*?)<\/image2>/i',$pogoda,$img2);
    preg_match('/<pressure>(.*?)<\/pressure>/i',$pogoda,$press);
    $imgp = substr($img2[1], 24);

$vivod = "<img align=\"top\" src=\"//img.yandex.net$imgp\" alt=\"$type[1]\" />$temp[1] °C
    $type[1]<br />
    Влажность: $vlaga[1] %<br />
    Давление: $press[1] мм рт.ст.";
    echo $vivod;

Парсинг XML от Яндекс-погоды. Только хардкор!

Запостил: huitator huitator, (Updated )

Комментарии (15) RSS

Добавить комментарий

Из-за тебя ушел bormand, guest!

    А не использовать ли нам bbcode?


    8