title: Google Map Gateway Timeout with PHP
body: <p>I've HTML form with 5 fields.</p>
  
  <p>1) Address 2) city 3) state 4) country 5) postcode.</p>
  
  <p>After input this field value it's show Google map. </p>
  
  <p><strong>Google map code:</strong></p>
  
  <pre><code>&lt;?php
  $add = urlencode($_POST['address']);
  $city = urlencode($_POST['city']);
  $state = urlencode($_POST['state']);
  $country  = urlencode($_POST['country']);
  $zip = $_POST['zip'];
  
  $geocode=file_get_contents('http://maps.google.com/maps/api/geocode   
  /json?address='.$add.',+'.$city.',+'.$state.',+'.$country.'&amp;sensor=false');
  
  $output= json_decode($geocode); //Store values in variable
  
  if($output-&gt;status == 'OK'){ // Check if address is available or not
  echo "&lt;br/&gt;";
  echo "Latitude : ".$lat = $output-&gt;results[0]-&gt;geometry-&gt;location-&gt;lat; //Returns Latitude
  echo "&lt;br/&gt;";
  echo "Longitude : ".$long = $output-&gt;results[0]-&gt;geometry-&gt;location-&gt;lng; // Returns Longitude
  ?&gt;
  &lt;script type="text/javascript"&gt;
  $(document).ready(function () {
  // Define the latitude and longitude positions
  var latitude = parseFloat("&lt;?php echo $lat; ?&gt;"); // Latitude get from above variable
  var longitude = parseFloat("&lt;?php echo $long; ?&gt;"); // Longitude from same
  var latlngPos = new google.maps.LatLng(latitude, longitude);
  // Set up options for the Google map
  var myOptions = {
  zoom: 10,
  center: latlngPos,
  mapTypeId: google.maps.MapTypeId.ROADMAP,
  zoomControlOptions: true,
  zoomControlOptions: {
  style: google.maps.ZoomControlStyle.LARGE
  }
  };
  // Define the map
  map = new google.maps.Map(document.getElementById("map"), myOptions);
  // Add the marker
  var marker = new google.maps.Marker({
  position: latlngPos,
  map: map,
  title: "test"
  });
  });
  &lt;/script&gt;
  &lt;div id="map" style="width:450px;height:350px; margin-top:10px;"&gt;&lt;/div&gt; // Div in which 
  Google   Map will show
  &lt;?php
  }
  ?&gt;
  </code></pre>
  
  <p>But after submit in process page it's show following error:</p>
  
  <blockquote>
    <p>Warning: file_get_contents(http://maps.google.com/maps/api/geocode<br>
        /json?address=,+Dhaka,+,+Bangladesh&amp;sensor=false): failed to open stream: HTTP request failed! 
        HTTP/1.0 504 Gateway Timeout in D:\Software\Installed\xampp\htdocs\Classified-website
        \lat-long.php on line 19</p>
    
    <p>Notice: Trying to get property of non-object in D:\Software\Installed\xampp\htdocs\Classified-
        website\lat-long.php on line 23</p>
  </blockquote>
  
  <p>What is the wrong in my code? Is there anyone help me?<br>
  Thanks. </p>
  
  <p><strong>No helpful answered!</strong></p>