I’m trying to get coordinates of address from google map with Classic Asp.
When I write this address in address bar I get correct result:
http://maps.google.com/maps/geo?output=xml&q=32822%20USA
But I get Code 602 (bad location from google) when I try to call same address with MSXML2.ServerXMLHttp
the asp codes:
url = "http://maps.google.com/maps/geo?output=xml&q=" & Server.URLEncode("32822 USA")
set xmlhttp = CreateObject("MSXML2.ServerXMLHTTP")
xmlhttp.open "GET", url, false
xmlhttp.send ""
xml = xmlhttp.responseText
set xmlhttp = nothing
Your problem here is not the URL, which is correctly formed, but the fact that you cannot do cross-domain XMLHttpRequest. Your request to the Google Maps Geocoding Service must be done from a server, that will fetch the XML content and return it to you ASP script.
Here’s what I would do: your ASP script might call a PHP file that queries Google Geocoding and fetches the response with cURL and returns it to the ASP that can then process it.
If you don’t want to use this solution, you might as well look at the Google Maps Javascript API that also provides Geocoding methods (link)