How to Weather with PHP & openweathermapin 3 easy steps

Tuesday 15th, Dec, 2015 | #PHP


OpenWeatherMap service is developed by team of IT specialists who have 10+ year expertise in development and applying of telecommunication solutions, experience in development and utilisation of Big Data technologies in practice, and many others.

Ideology of the service is inspired by OpenStreetMap and Wikipedia that make information free and available for everybody. Today the service delivers 1 billion forecasts per day. It provides open weather data for more than 200,000 cities and any geo location via our web-site and API.

Step 1 - Get API Key

To access the API you need to sign up for an API key

Step 2 - Locate ID City

You need get city ID from

Step 3 - The Code


//units=For temperature in Celsius use units=metric
//5128638 is new york ID

$url = "{APIKEY}";

$contents = file_get_contents($url);

//how get today date time PHP :P
$today = date("F j, Y, g:i a");
$cityname = $clima->name; 

echo $cityname . " - " .$today . "<br>";
echo "Temp Max: " . $temp_max ."&deg;C<br>";
echo "Temp Min: " . $temp_min ."&deg;C<br>";
echo "<img src='" . $icon ."'/ >";