Najlepsza odpowiedź unbreak, 18 marca 2014 - 17:00
Tutaj to akurat możesz zrobić zupełnie inaczej, dużo łatwiej
<?php $file_contents = file_get_contents("http://api.openweathermap.org/data/2.5/weather?q=Katowice,pl"); $array = json_decode($file_contents,true); echo $array['main']['temp']; //285.58 ?>
Masz dzięki temu też dostęp do wszystkich innych parametrów. Swoją drogą musisz ustawić żeby temperatura była w Celcjuszach, bo teraz są w ... nie wiem
Wystarczy że w urlu dasz units=metric:
$file_contents = file_get_contents("http://api.openweathermap.org/data/2.5/weather?units=metric&q=Katowice,pl");Przejdź do postu