Hi! Could we please enable some services and cookies to improve your experience and our website?

PHPize | SQLize | SQLtest

Online Sandbox for SQL and PHP: Write, Run, Test, and Share SQL Queries and PHP Code

A A A
Login    Share code      Blog   FAQ
Copy Format Clear

Stuck with a problem? Got Error? Ask AI support!

Copy Clear
Copy Format Clear
<?php $lat = "46.675827"; $lon = "127.018433"; $key = "523df554f4e883874873853b897b6da0"; $url = "https://api.openweathermap.org/data/2.5/weather?lat=$lat&lon=$lon&appid=$key&units=metric"; $data = file_get_contents($url); $json = json_decode($data, true); $cb1 = $json['main']['temp']; $cb2 = $json['main']['feels_like']; $cb3 = $json['visibility']; $cb3 = $cb3 / 1000; $cb4 = $json['wind']['speed']; $cb4 = 3.6*$cb4; $cb5 = $json['dt']; $cb0_1 = date("H:i y-m-d",$json['dt']); echo("Temperature: ".$cb1." °C"."\n"."Feels: ".$cb2." °C"."\n"."Visibility: ".$cb3." km"."\n"."Wind: ".$cb4." km/h"."\n"."Time of data collection: ".$cb0_1); #print_r($json);
Copy Clear