Welcome to WebmasterWorld Guest from

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

better way to scrape google result?



11:50 pm on Aug 4, 2009 (gmt 0)

5+ Year Member


When users enter a string into an inputbox, I'd like that string to go two ways: one is to query our database, and google results will also be shown at the same time.

The only way I know (and apparently a silly way) is to use fopen(). For example,

$search_string = $_GET('searchstring')

$requesturl = "http://www.google.com/search?q=".$search_string;

Then use fopen() to scrap the page and trim out unnecessary layout.

I'm wondering if there's a better way to deal with it? I've briefly taken a look on Google AJAX Search. Is it possible to make a form processing that can combine google AJAX search and my local database together?

Any advice is appreciated.


2:12 am on Aug 5, 2009 (gmt 0)

WebmasterWorld Senior Member eelixduppy is a WebmasterWorld Top Contributor of All Time 10+ Year Member

I would go with the Google AJAX API service. You have to then create Javascript that sends an XML request to a PHP script on your server that grabs the data from your database, and then you combine the two results together.

If you need help with the AJAX part of things I suggest you take a look on over in the Javascript Forum [webmasterworld.com] here at WebmasterWorld.


9:52 pm on Aug 8, 2009 (gmt 0)

5+ Year Member

thanks a lot. I'm trying to get some code example on using google ajax api .


9:05 am on Aug 10, 2009 (gmt 0)

5+ Year Member

You could also try using a DOM parser, such as [simplehtmldom.sourceforge.net...]

I find this is very useful for processing the page results once obtained


Featured Threads

Hot Threads This Week

Hot Threads This Month