Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Google Phonebook Lookup
Message
 
To
18/01/2007 21:50:45
Terry Davis
Enhanced systems consulting
Tennessee, United States
General information
Forum:
Visual FoxPro
Category:
ActiveX controls in VFP
Environment versions
Visual FoxPro:
VFP 7 SP1
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01186855
Message ID:
01187296
Views:
20
>some time ago, I saw an article that used the o = CreateObject('InternetExplorer.Application') to perform a google call for phone number lookup. Then used parsing of the "o.Document.Body.InnerText" to get the corresponding name, address, city, state and zip and populated a customer form. I made some mods to it and it has worked fine up until recently. Now the "o.Document.Body.InnerText " does not return the page info to allow for parsing.
>
>Does anyone remember seeing this, using this, or can you explain why the sudden break??
>
>thanks
Your problem with the intellisense is a known quantity. If you want to see more try this.

x=o.document
x.(will pullup intellisense now)

Otherwise, I think this snippet might help. (I am actually running something like this right now)
* googlephonebyname.prg
* John Harvey

If Type('OIE')='U'
	Public oie
	oie=Creat('internetexplorer.application')
	OIE.VISIBLE=.T.
ENDIF
* obviously, I have a table with the fields; firstname,lastname,city 
* (you can add an address, if you want to narrow the search)

lcfirst=LEFT(ALLTRIM(FIRSTNAME),1)
m.city=ALLTRIM(city)
LClast=ALLTRIM(LASTNAME)
lcaddress=', '+Alltrim(m.city)+', TN'
lcurl=[http://www.google.com/search?hl=en&lr=&pb=f&biw=1003&q=]+Alltrim(Proper(LCFIRST))+[+]+Alltrim(Proper(LCLAST))+[+]+lcaddress+[&pb=f]
oie.Navigate(lcurl)

Do While oie.readystate<>4
Enddo
Do While oie.Document.readystate<>'complete'
Enddo

lc=oie.Document.body.innertext
m.hphone=''
* I parsed the return to locate the area code I wanted, then I looped through and 
* checked to see if the street name matched the one I had in my table. If so,
* I pulled the number.

*!*	If Occurs('901)',lc)>0
*!*		For i = 1 To Memlines(lc)
*!*			lcline=Mline(lc,i)
*!*			If Occurs(UPPER(Alltrim(m.streetname)),UPPER(lcline))>0
*!*				m.phone= Substr(lc,At('901',lc)+5,8)
*!*				m.hphone=m.phone+' '+Alltrim(FIRSTname)+' '+ALLTRIM(LASTNAME)
*!*				?M.phone+' '+Alltrim(FIRSTname)+' '+ALLTRIM(LASTNAME)+' '+STREETname
*!*			Endif
*!*		Endfor

*!*		Wait Window Timeout .25
*!*		IF LEN(ALLTRIM(m.phone))>0
*!*		Replace phone With m.phone
*!*		endif
*!*	Endif
Return m.hphone
John Harvey
Shelbynet.com

"I'm addicted to placebos. I could quit, but it wouldn't matter." Stephen Wright
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform