homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

better way to scrape google result?

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


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)

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)

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)

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

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved