title: How to get a User's Current Location Using Google Geocode API and PHP
body: <p>I have created an app with and as part of data collection I would like to capture the user's current location when they access the app and website using php.</p>
  
  <p>Ideally, I want to make this as simple as possible.  Currently, I have the following script, but it has a default address in it:</p>
  
  <pre><code>$fullurl = "http://maps.googleapis.com/maps/api/geocode/json?address=1600+Amphitheatre+Parkway,+Mountain+View,+CA&amp;sensor=true";
  echo $json;
  $string .= file_get_contents($fullurl); // get json content
  $json_a = json_decode($string, true); //json decoder
  
  echo $json_a['results'][0]['geometry']['location']['lat']; // get lat for json
  echo $json_a['results'][0]['geometry']['location']['lng']; // get ing for json
  </code></pre>
  
  <p>I would like the current location of the user to take the place of 1600 Amphitheater Parkway, Mountain View, CA.</p>
  
  <p>Any help is extremely appreciated.</p>