<?php
$apiUrl = "https://api.openweathermap.org/data/2.5/weather?q=sivas&appid=a3b2f4740abf2ee79ee7f71b2f40543e&units=metric&lang=tr";
// API'ye istek yapma
$response = file_get_contents( $apiUrl );
// Yanıtı işleme
$data = json_decode( $response, true );
if ( $data ) {
echo "<img src='https://openweathermap.org/img/w/" . $data[ 'weather' ][ 0 ][ 'icon' ] . ".png' alt='Hava Durumu İkonu'><br>";
echo "<strong>" . str_replace( " Province", "", $data[ 'name' ] ) . "/Merkez </strong><br>";
echo "Sıcaklık: " . $data[ 'main' ][ 'temp' ] . "°C<br>";
echo "Nem: " . $data[ 'main' ][ 'humidity' ] . "%<br>";
echo "Açıklama: " . $data[ 'weather' ][ 0 ][ 'description' ] . "<br>";
} else {
echo "Hava durumu bilgileri alınamadı.";
}
?>İşini görürse kullanabilirsin.