*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 NEXTI 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?
>>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