Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: [inne]Google weather XML
Forum PHP.pl > Forum > Przedszkole
xxdrago
Witam, mam taki skrypt jak mam go poustawiać aby całość z tego XML była po Polsku? głownie chodzi mi o te linijki:
  1. $xml = simplexml_load_file('http://www.google.com/ig/api?weather=jaworzno&oe=utf-8');
  2. $information = $xml->xpath("/xml_api_reply/weather/forecast_information");
  3. $current = $xml->xpath("/xml_api_reply/weather/current_conditions");
  4. $forecast_list = $xml->xpath("/xml_api_reply/weather/forecast_conditions");



  1. <?
  2. $xml = simplexml_load_file('http://www.google.com/ig/api?weather=jaworzno&oe=utf-8');
  3. $information = $xml->xpath("/xml_api_reply/weather/forecast_information");
  4. $current = $xml->xpath("/xml_api_reply/weather/current_conditions");
  5. $forecast_list = $xml->xpath("/xml_api_reply/weather/forecast_conditions");
  6. ?>
  7. <html>
  8. <head>
  9. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2" />
  10. <title>Pogoda Jaworzno</title>
  11. </head>
  12. <body>
  13. <h1><?= print $information[0]->city['data']; ?></h1>
  14. <h2>Pogoda na dzis:</h2>
  15. <div class="weather">
  16. <img src="<?php
  17. $pattern[0] = '/ig/images/weather/';
  18. $pattern[1] = '.gif';
  19. $replacement[0] = 'http://ssl.gstatic.com/onebox/weather/60/';
  20. $replacement[1] = '.png';
  21. $pogoda = str_replace($pattern, $replacement, $current[0]->icon['data']);
  22. echo $pogoda;
  23. ?>" alt="weather"?>
  24. <span class="condition">
  25. <?= $current[0]->temp_c['data'] ?>&deg; C,
  26. <?= $current[0]->condition['data'] ?>
  27. </span>
  28. </div>
  29. <h2>Pogoda na kolejne dni:</h2>
  30. <? foreach ($forecast_list as $forecast) : ?>
  31. <div class="weather">
  32. <img src="<?php
  33. $pattern[0] = '/ig/images/weather/';
  34. $pattern[1] = '.gif';
  35. $pattern[2] = 'mostly_sunny';
  36. $pattern[3] = 'sunny';
  37.  
  38.  
  39. $replacement[0] = 'http://ssl.gstatic.com/onebox/weather/35/';
  40. $replacement[1] = '.png';
  41. $replacement[2] = 'partly_cloudy';
  42. $replacement[3] = 'sun';
  43. $pogoda = str_replace($pattern, $replacement, $forecast->icon['data']); // Podmiana adresu.
  44. echo $pogoda;
  45. ?>" alt="weather"?>
  46. <div><?= $forecast->day_of_week['data']; ?></div>
  47. <span class="condition">
  48. <?= $forecast->low['data'] ?>&deg; F - <?= $forecast->high['data'] ?>&deg; F,
  49. <?= $forecast->condition['data'] ?>
  50. </span>
  51. </div>
  52. <? endforeach ?>
  53. </body>
  54. </html>
Monter08
  1. $xml = simplexml_load_file('http://www.google.pl/ig/api?weather=jaworzno&oe=utf-8');

Polskie google?
nospor
Wpisałem w google fraze: ig/api?weather język
Odpowiedź na Twoje pytanie znalazła się dosłownie w 5 sekund
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.