i'm while using following code on local and becoming right result

$geocode=file_get_contents('http://maps.google.com/maps/api/geocode/json?address='.$_GET['zip'].'&sensor=true');
$output= json_decode($geocode);
//print_r($output);
$lat = $output->results[0]->geometry->location->lat;
$long = $output->results[0]->geometry->location->lng;
echo "Latitude : ".$lat;
echo "Longitude : ".$long;

but when i upload that code on live server i quickly receive null object