Skip to content

Instantly share code, notes, and snippets.

@xombra
Created June 22, 2015 13:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save xombra/9e538abbb0825a927c85 to your computer and use it in GitHub Desktop.
Save xombra/9e538abbb0825a927c85 to your computer and use it in GitHub Desktop.
# extraer la ubicacion (latitud y longitud)
# desde Google Maps
#
function CLIMA($latitud,$longitud)
{ $url = "http://api.openweathermap.org/data/2.5/weather?lat=$latitud&lon=$longitud&units=metric";
# --------------------
$clima = file_get_contents($url);
$json = json_decode($clima);
$temperatura = $json->main->temp;
# $temperaturamax = $json->main->temp_max;
# $temperaturamin = $json->main->temp_min;
# $presion = $json->main->pressure;
# $humedad = $json->main->humidity;
# $viento = $json->main->speed;
return $temperatura;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment