Link to home
Start Free TrialLog in
Avatar of pigmentarts
pigmentartsFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Google.cfc

using google.cfc found at: http://surfmind.com/lab/cf/google/

search the results like this..

<cfinvoke component="google" method="search" returnvariable="googleResults" >
                          <cfinvokeargument name="q" value="#form.keyword#"/>
                          <cfinvokeargument name="start" value=1/>
                          <cfinvokeargument name="maxResults" value="10">
                          <cfinvokeargument name="key" value="eQgLAotQFHIROZH7prl7ozQj2A74N+r3">
                        </cfinvoke>
                  
                  <cfset googlecount = 0>
                  <cfloop index="thisElement" from="1" to="#ArrayLen(googleResults)#">
                  <cfset googlecount = googlecount + 1>
                              
                              <cfif find("#form.website#", googleResults[thisElement].url)>
                                    <cfset sucess = true>
                                    
                                    <cfbreak>
                              </cfif>
                              
                  
            
                  </cfloop>


the i outprint the one i am after like this:

<b>Page Title:</b> #googleResults[thisElement].title#<br />

but there are a few things in the cfc i have spotted and would like to know how i pull them with the resluts above these are...


numruns
TotalResultsCount
SearchTime

can this be done any how? many thanks
Avatar of mrichmon
mrichmon

Where do you see those?

Per documenation what is returned is an array containing:
CACHEDSIZE
HOSTNAME
SNIPPET
SUMMARY
TITLE
URL

If you want anything else returned the source of the CFC will have to be modified to add those values to the array of results
Avatar of pigmentarts

ASKER

Yes sorry thats what i was trying to ask. i see in the google.cfc he uses numruns like this

<!--- Local Variable for Return --->
            <cfset var arResult = arrayNew(1)>
            <cfset var arResults = arrayNew(1)>
            <cfset var arReturn = arrayNew(1)>
            <cfset var startrow = arguments.start>
            <cfset var results = "">
            <cfif arguments.maxresults gt 10>
                  <cfset numruns = round(arguments.maxresults/10)>
                  <cfset arguments.maxresults = 10>
            <cfelse>
                  <cfset numruns = 1>
            </cfif>

wanted to know is how i can get it out?

also where do i start to look at trying to get the other things i know the method doGoogleSearch can get from googles API but not dealt with in google.cfc like TotalResultsCount etc?
ASKER CERTIFIED SOLUTION
Avatar of mrichmon
mrichmon

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
will do, many thanks again for posting any helping me out.