Sign in to follow this  
edwinnie

activate search engine from code

Recommended Posts

edwinnie    122
Hi! I jus wanna noe if there can be such a way for a c++ or c# program to activate a search engine(google) on the web to return a list of top 10 documents found for the search. thx! Edwinz

Share this post


Link to post
Share on other sites
Drew_Benton    1861
Well I know there is definitly a way in C++, so there has to be a way in C#. Here is the theory of it:

1. Get search query from user in program.

2. Program generates an url to be searched with:
EX: http://www.google.com/search?hl=en&q=Test&btnG=Google+Search The red will never change, but you can change around the orange. Of course you could use a lot of other search engines as well [smile]

3. Using something like WinSock (standard networking stuff on Windows), you download the page and store it in memory. More than likely, you would use the Standard C++ library to ease with manipulation.

4. With that all you have to do is parse through the file.
EX: If you look at the source results, all you would have to do is obtain the data between the tags to get all the data, to which through further processing, you can generate a list of what you need. I can't post the tags because GameDev will try to use them, but if you look at the source you should see a division of it.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster
i think that google offers a (limited) free webservice for you to call from your c# application to obtain search results. might be interesting.

Share this post


Link to post
Share on other sites
edwinnie    122
hi all!

hmm i saw that the google web api site is down.

so doing below so far only activates the browser and searched once
http://www.google.com/search?hl=en&q=Test&btnG=Google+Search

but i still need to pull top k documents out.
how to do that?

i am using c# and .net

thx!
Edwinz

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this