Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Google Address Verification?
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 7 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01395898
Message ID:
01395975
Views:
167
As an alternative you can also use query strings with a plain HTTP client to retrieve the data.

http://maps.google.com/maps?f=q&source=s_q&hl=en&geocode=&q=300+N.+15th+Street,+Hood+River+OR+97031&sll=37.0625,-95.677068&sspn=50.557552,81.298828&ie=UTF8&z=16&iwloc=A

Using any HTTP client (XmlHttp, wwHttp, WinInet) should allow you to retrieve content the same way and parse out the details without the overhead of Web Browser control:
DO wwHttp
loHttp = CREATEOBJECT("wwHTTP")
lcHtml = loHttp.HttpGet("http://maps.google.com/maps?f=q&source=s_q&hl=en&geocode=&q=10+SS.+15th+Street,+Hood+River+OR+97031&sll=37.0625,-95.677068&sspn=50.557552,81.298828&ie=UTF8&z=16&iwloc=A")
ShowText(lcHtml)
RETURN
This data is a bit more terse - mostly JSON but you can probably find the right kind of text in there for failure scenarios as well. I didn't look closely on figuring out whether it worked or not <s>...

FWIW, your code that checks for Did you mean: may be fragile - it'll only work if the address can resolve to something else.

I think you may also be able to utilitize the Google Map API for address lookups. They have a GeoTagging API that you can pass an address to - if that fails to produce a geo code I presume you could assume that the address doesn't exist?

Lots of options.

+++ Rick ---

>>Has anyone tried using Google Maps for address verification? That is, send the address to Google and _retrieve_ a standardized format address or a "did you mean" address?
>
>One of the solutions:
>
>
>=YGoogleMapSearch("11072 Greinerrr Rd., Phila")
>
>Procedure YGoogleMapSearch
>LPARAMETERS lcAddress
>#DEFINE READYSTATE_COMPLETE 4
>clear
>if not (type("oIE")="O" and not isnull(oIE))
>	oIE = CreateObject("InternetExplorer.Application")
>endif
>
>oie.visible=.t.
>lcURL="http://maps.google.com/"
>
>oIE.Navigate(lcURL)
>
>do while oIE.Readystate <> READYSTATE_COMPLETE
>	wait wind time 1.0 ""
>enddo
>
>oShell = CreateObject("WScript.Shell")
>lnstart=second()
>do while not oShell.AppActivate(OIE.DOCUMENT.title) and second()-lnstart <=10
>	wait wind time 1.0 "Entering ..."
>ENDDO
>
>if oShell.AppActivate(OIE.DOCUMENT.title)
>    oShell.SendKeys(lcAddress+"{ENTER}")
>    WAIT WINDOW TIMEOUT 1.0 ""
>
>     DO case
>    CASE "Did you mean:" $OIE.DOCUMENT.body.innerText
>	lcresult= SUBSTR(OIE.DOCUMENT.body.innerText, AT("Did you mean:",OIE.DOCUMENT.body.innerText))
>	?LEFT(lcresult,AT(CHR(13),lcresult))
>	?substr(lcresult,AT(CHR(13),lcresult)+2,AT(CHR(13),lcresult,2) -AT(CHR(13),lcresult)-1)
>     ENDCASE
>endif
>
>RETURN
>
>
+++ Rick ---

West Wind Technologies
Maui, Hawaii

west-wind.com/
West Wind Message Board
Rick's Web Log
Markdown Monster
---
Making waves on the Web

Where do you want to surf today?
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform