pigmentarts
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="googleResu lts" >
<cfinvokeargument name="q" value="#form.keyword#"/>
<cfinvokeargument name="start" value=1/>
<cfinvokeargument name="maxResults" value="10">
<cfinvokeargument name="key" value="eQgLAotQFHIROZH7prl 7ozQj2A74N +r3">
</cfinvoke>
<cfset googlecount = 0>
<cfloop index="thisElement" from="1" to="#ArrayLen(googleResult s)#">
<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#<b r />
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
search the results like this..
<cfinvoke component="google" method="search" returnvariable="googleResu
<cfinvokeargument name="q" value="#form.keyword#"/>
<cfinvokeargument name="start" value=1/>
<cfinvokeargument name="maxResults" value="10">
<cfinvokeargument name="key" value="eQgLAotQFHIROZH7prl
</cfinvoke>
<cfset googlecount = 0>
<cfloop index="thisElement" from="1" to="#ArrayLen(googleResult
<cfset googlecount = googlecount + 1>
<cfif find("#form.website#", googleResults[thisElement]
<cfset sucess = true>
<cfbreak>
</cfif>
</cfloop>
the i outprint the one i am after like this:
<b>Page Title:</b> #googleResults[thisElement
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
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?
<!--- 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
<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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
will do, many thanks again for posting any helping me out.
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