Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Is it possible to access the google api in VFP
Message
From
15/04/2002 08:02:37
 
General information
Forum:
Visual FoxPro
Category:
Web Services
Miscellaneous
Thread ID:
00644266
Message ID:
00644960
Views:
17
Hi Hector:
I had to make a change in the FOR loop to get the results (or did I miss something else?):
CLEAR
#DEFINE GOOGLEKEY "go to http://www.google.com/apis/ to get your own key"
#DEFINE GOOGLEWSDLFILE "c:\google\googlesearch.wsdl"

LOCAL oGoogle AS Google
LOCAL loWS
loWS = NEWOBJECT("Wsclient",HOME()+"ffc\_webservices.vcx")
loWS.cWSName = "Google"
oGoogle = loWS.SetupClient(GOOGLEWSDLFILE, [GoogleSearchService], [GoogleSearchPort])

cQuery= "essential fox"
nStart= 0
nMaxResults= 10
lFilter= .F.
cRestrict= ""
lSafeSearch= .T.
cLR= ""
cIE= "latin1"
cOE= "latin1"

* Results come in an XML object.
oResults = oGoogle.doGoogleSearch( GOOGLEKEY, cQuery, nStart, ;
	nMaxResults, lFilter , cRestrict , lSafeSearch, ;
	cLR, cIE, cOE )

* Scan XML and look for "resultElements" node.
* A better implementation will be required, but for
* demo this is OK.
IF TYPE( "oResults" ) != "O" OR ISNULL( oResults )
	? "something went wrong"
ELSE
	? oResults.LENGTH, " results were found for [", cQuery ,"]"
	? "Results will be pasted to clipboard"
	_CLIPTEXT = ""
	FOR i=1 TO oResults.LENGTH
		oTemp = oResults.nextnode
		IF oTemp.nodename = "resultElements"
			oActualResults = oTemp.childnodes
			FOR j=0 TO oActualResults.LENGTH-1
				? "=================================================="
				? "Result ", j+1
				? oActualResults.ITEM(j).TEXT
				_CLIPTEXT=_CLIPTEXT+oActualResults.ITEM(j).TEXT
				? oActualResults.ITEM(j).TEXT
			NEXT
		ENDIF
	NEXT
ENDIF
RETURN

* eof()
Tracy
>>Hello all
>>
>>Is it possible to access the google api in VFP,(see the main page for google api)
>>
>>txs
>Yes, it is. Take a look at http://fox.wikis.com/wc.dll?Wiki~GoogleWebServiceUsingVFP~VFP
.·*´¨)
.·`TCH
(..·*

010000110101001101101000011000010111001001110000010011110111001001000010011101010111001101110100
"When the debate is lost, slander becomes the tool of the loser." - Socrates
Vita contingit, Vive cum eo. (Life Happens, Live With it.)
"Life is not measured by the number of breaths we take, but by the moments that take our breath away." -- author unknown
"De omnibus dubitandum"
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform