Good morning all!

Does anyone knows how to do a google search programatically?

I'm developing a Java applications that must do a google search like: http://www.google.pt/search?q=something+to+search

When i try to call this link programatically, the http response is: Forbidden.

I know that there is a Google API to handle this kind of situations, but i can't find it.

thanks a lot for your help.

Regards, Joao

+1  A: 

If you do a correct http request with usual http headers (including user-agent), there should be no problem, google will not distinguish your program from any web browser. So there's a probably a problem with your code. If it's some default call with a default user-agent, there might be a prohibited user-agents for which google will not return valid results. But in this case you can make your own http request with your own user-agent


You could take a look at http://code.google.com/apis/ajaxsearch/documentation/#fonje .

I prefer Yahoo! and Microsoft's API's, though, as they are better-documented and unlimited (the Google API is a pain to work with).