title: coordinates function sometimes not working
body: <p>I'm using this function to get the coordinates of any address:</p>
  
  <pre><code>function getCoordinates($address) {
      $address = str_replace(" ", "+", $address); // replace all the white space with "+" sign to match with google search pattern
      $address = str_replace("-", "+", $address); // replace all the "-"  with "+" sign to match with google search pattern
      $url = "http://maps.google.com/maps/api/geocode/json?address=$address";
      $response = file_get_contents($url);
      $json = json_decode($response,TRUE); //generate array object from the response from the web
      return ($json['results'][0]['geometry']['location']['lat'].",".$json['results'][0]['geometry']['location']['lng']);
  }
  </code></pre>
  
  <p>Sometimes it works and sometimes it only gets "," for the same address.</p>
  
  <p>Do I need to use another function?</p>