using the link
http://api.openweathermap.org/data/2.5/weather?q=Schimmert,nl
without the "." gives me a response
{
"message": "Error: Not found city",
"cod": "404"
}
<?php
$getData = file_get_contents( "http://api.openweathermap.org/data/2.5/weather?q=Schimmert,nl");
$decode = json_decode($getData);
echo $decode->message;
echo "<br/>";
echo $decode->cod;
$decode = json_decode($getData, TRUE);
echo "<br/>";
echo $decode['message'];
echo "<br/>";
echo $decode['cod'];
so when use the link with the "."
http://api.openweathermap.org/data/2.5/weather?q=Schimmert,nl.
gives a response of :
{
"coord": {
"lon": 5.83,
"lat": 50.91
},
"sys": {
"message": 0.0287,
"country": "Netherlands",
"sunrise": 1430884846,
"sunset": 1430939149
},
"weather": [
{
"id": 800,
"main": "Clear",
"description": "Sky is Clear",
"icon": "01n"
}
],
"base": "stations",
"main": {
"temp": 284.923,
"temp_min": 284.923,
"temp_max": 284.923,
"pressure": 1012.18,
"sea_level": 1023.56,
"grnd_level": 1012.18,
"humidity": 67
},
"wind": {
"speed": 6.06,
"deg": 219.002
},
"clouds": {
"all": 0
},
"dt": 1430875602,
"id": 0,
"name": "Nuth",
"cod": 200
}
to show the the result
echo $decode->coord->lon;
echo $decode->coord->lat;
echo $decode->sys->message;
echo $decode->sys->country;
echo $decode->weather[0]->id;
echo $decode->weather[0]->main;
echo $decode->weather[0]->description;
echo $decode->main->temp;
echo $decode->main->temp_min;
echo $decode->wind->speed;
echo $decode->clouds->all;
echo $decode->id;
echo $decode->name;
echo $decode->cod;