1 Replies - 1174 Views - Last Post: 09 August 2011 - 11:07 AM Rate Topic: -----

#1 coldfusionnewbie  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 08-August 11

Google Top Ten Search Results in ColdFusion

Posted 09 August 2011 - 08:40 AM

Hello there. I am trying to expand on some existing code to refine it. I am trying to do two main things with it. One, to add a search bar that allows user input and 2) to restrict the results to only the first 10.

<!--- Grab the google search results. --->
<cfhttp
url="http://www.google.com/search?hl=en&lr=&q=Cold+Fusion+Google&btnG=Search"
useragent="Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727; FDM)"
result="objGoogleGrab"
method="GET"
resolveurl="true"
/>
 
<!--- Output the search results. --->
<cfoutput>
#objGoogleGrab.FileContent#
</cfoutput>



So I admit I am a cold fusion newbie, as my name suggests, but I have worked with ASP.net. If the two even close to comparable capabilities, I will just create two string variables. One will contain the user input, one will be the final google search. I know how I would do this in asp.net, just make the final google search equal to "http://www.google.com/search?hl=en&lr=&q=" + userinput + "&btnG=Search" and have that all run when they click a search button. I don't even have to parse the input because google takes spaces in the url and automatically converts them.

However the issue I can't seem to resolve is this: How do I limit the results to just 10. I can alter the google search parameters to just show 10 results per page, but I can't seem to find out how to remove the pagination altogether and just get the 10 results.

Any help would be appreciated.

This post has been edited by coldfusionnewbie: 09 August 2011 - 08:41 AM


Is This A Good Question/Topic? 0
  • +

Replies To: Google Top Ten Search Results in ColdFusion

#2 macosxnerd101  Icon User is offline

  • Self-Trained Economist
  • member icon




Reputation: 10667
  • View blog
  • Posts: 39,615
  • Joined: 27-December 08

Re: Google Top Ten Search Results in ColdFusion

Posted 09 August 2011 - 11:07 AM

You do know that scraping Google searches violates their terms of service, right? As such, I'm going to close this thread in compliance with the DIC terms of service. We do not support activities which are malicious, unethical, or illegal in nature.


Edit via Craig328: You do know there is a Google search API, right? Rather than screen scrape Google search, why not simply use their API?

This post has been edited by Craig328: 23 August 2011 - 07:31 AM
Reason for edit:: Added non-illegal solution comment

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1