0

I am trying to gelocate a location

If i use this one $response = wp_remote_get( $url ); I am getting the (Please use an API key with all your API calls to avoid service interruption. For further details please refer to http://g.co/dev/maps-no-account", "results" : [], "status" : "OVER_QUERY_LIMIT" } ) error from google But if i am trying to use the hard coded link it works:

 $response2 = wp_remote_get( "https://maps.googleapis.com/maps/api/geocode/json?address=long%2Bisland%2Bcity%2Bny%2B11103%2Busa&key=AIzaSyBdjwjKwkVOkZZDftw4VWMenxE5bnUeC2E&region=US&language=EN&sansor=false");

Any ideea why ?

PixelArtie
  • 31
  • 8

1 Answers1

0

There is a two way,

  1. Use within double quote, This is just a try,

    $response = wp_remote_get("$url");

  2. I can see OVER_QUERY_LIMIT in your response from geocoder. The Google geocoder has quota and rate limits. The best solution is to delay when you get OVER_QUERY_LIMIT errors and then retry.

If query limit is the problem try below options,

  1. OVER_QUERY_LIMIT in Google Maps API v3: How do I pause/delay in Javascript to slow it down?
  2. How do I Geocode 20 addresses without receiving an OVER_QUERY_LIMIT response?