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 09:43:44
General information
Forum:
Visual FoxPro
Category:
Web Services
Miscellaneous
Thread ID:
00644266
Message ID:
00644997
Views:
9
>I couldn't get it to work correctly without these
> changes, so I assumed they were correct. I figured
> something got chopped off when it was posted on the
> wiki or something. Was I wrong?
No, you were right.

Line _CLIPTEXT=_CLIPTEXT+oActualResults.ITEM(j).TEXT some how got divided in two lines in the wiki when it added the "?" mark after oActualResults. I'll go and fix it there in a little bit.

Thanks for the notice!




>Sorry, I should have documented it better. Here are my minor changes:
>
>
>*Removed question marks from the following:
>oGoogle = loWS.SetupClient(GOOGLEWSDLFILE, [GoogleSearchService], [GoogleSearchPort])
>*Modified FOR NEXT LOOP
>*Original loop:
>FOR j=0 TO oActualResults.LENGTH-1
>	? "=================================================="
>	? "Result ", j+1
>	? oActualResults.ITEM(j).TEXT
>	_CLIPTEXT=_CLIPTEXT+oActualResults
>	?.ITEM(j).TEXT
>NEXT
>*Modified version:
>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
>
>
>I couldn't get it to work correctly without these changes, so I assumed they were correct. I figured something got chopped off when it was posted on the wiki or something. Was I wrong?
>TIA,
>Tracy
>
>
>>>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
Reply
Map
View

Click here to load this message in the networking platform