Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Is it possible to access the google api in VFP
Message
 
To
15/04/2002 08:02:37
General information
Forum:
Visual FoxPro
Category:
Web Services
Miscellaneous
Thread ID:
00644266
Message ID:
00644977
Views:
8
>I had to make a change in the FOR loop to get the results
> (or did I miss something else?):
What exactly did you change? I noticed some words in upper case, Is that what you changed?

I did notice that the Wiki added some question marks to the code that I posted (e.g. oActualResults -> oActualResults?) -- that could also break the VFP code.


>
>
>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
Hector Correa
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform