Welcome to WebmasterWorld Guest from 54.82.57.154

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)

Junior Member

5+ Year Member

joined:June 18, 2008
posts:85
votes: 0


Hi,

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)

Senior Member

joined:Nov 12, 2005
posts:5967
votes: 0


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)

Junior Member

5+ Year Member

joined:June 18, 2008
posts:85
votes: 0


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)

New User

5+ Year Member

joined:May 28, 2008
posts:12
votes: 0


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

 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members