Skip to content

Instantly share code, notes, and snippets.

@juan2three
Created August 25, 2016 16:05
Show Gist options
  • Save juan2three/88fceba5daee59cee43b90626cac1e4e to your computer and use it in GitHub Desktop.
Save juan2three/88fceba5daee59cee43b90626cac1e4e to your computer and use it in GitHub Desktop.
<?php
$url = 'http://api.openweathermap.org/data/2.5/weather?q=Orlando&appid=e489a1082a7bba282ae688164b05ebe1&units=metric';
$ch = curl_init();
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
// curl_setopt($ch,CURLOPT_HEADER, false);
$output=curl_exec($ch);
curl_close($ch);
//echo "<pre>";
$data = json_decode($output,true);
$data = $data[0];
echo "Name - ".$data['main'];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment