<?php include('../settings.php');?>
<?php // current sky
function curl_file_get_contents($url)
{
   $ch = curl_init(); //initiate curl
       curl_setopt($ch, CURLOPT_HEADER, 0);//0 means response headers will not be included in output.
   curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); //1 means curl will return the contents as output of this function, instead of printing them inside this function.
   curl_setopt($ch, CURLOPT_URL, $url);
    $data = curl_exec($ch);//request sent to the url
   curl_close($ch);
    return $data;
}
$curl_response = curl_file_get_contents('http://api.wunderground.com/api/'.$api.'/conditions_v11/q/pws:'.$id.'.json'); //Just change URL to what ever page you want to fetch
$json = curl_file_get_contents('http://api.wunderground.com/api/'.$api.'/conditions_v11/q/pws:'.$id.'.json');
$data = json_encode($json);
$file = '../jsondata/weather.json';
file_put_contents($file, $json);
?>

<?php //earthquake regional
function curl_file_get_contents($url)
{
   $ch = curl_init(); //initiate curl
       curl_setopt($ch, CURLOPT_HEADER, 0);//0 means response headers will not be included in output.
   curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); //1 means curl will return the contents as output of this function, instead of printing them inside this function.
   curl_setopt($ch, CURLOPT_URL, $url);
    $data = curl_exec($ch);//request sent to the url
   curl_close($ch);
    return $data;
}
$curl_response = curl_file_get_contents('http://earthquake-report.com/feeds/recent-eq?json'); //Just change URL to what ever page you want to fetch
$json = curl_file_get_contents('http://earthquake-report.com/feeds/recent-eq?json');
$data = json_encode($json);
$file = '../jsondata/eqnotification.json';
file_put_contents($file, $json);
?>

