I have 3 or 4 keywords I want to send from my PHP page to Google and return one page as if I had gone on to Google's site and searched using "I'm feeling lucky."

Does anyone know how to supply the keywords to Google?

What is the format?


www.google.co.uk/lucky?keywords="the royal family"


Replace "stackoverflow" with your keywords.

| improve this answer | |
  • Stripped to the bare minimum :) – Daniel Vassallo Feb 26 '10 at 15:37
  • I saw that "I am lucky button" has name=btnI, I wonder how did you know that it should be written to web site adress by appending to the end? – stckvrflw Feb 26 '10 at 15:47
  • 2
    Actually I inpected with Fiddler to see what URL was being requested upon clicking the "Feeling Lucky" button. Then I stripped all the obvious redundant parameters like language, source, etc from the URL, until I couldn't strip anymore. – Daniel Vassallo Feb 26 '10 at 15:52
  • 1
    Nice. That is the perfect answer! – marcusw Feb 26 '10 at 16:38

Like this:


I stands for Instant.

| improve this answer | |
  • 1
    Why doesn't the I stand for "I'm feeling lucky?" – Daniel Vassallo Feb 26 '10 at 15:40
  • 1
    it does (it is the name of the button) put the browser removed everything after the ' – Hogan Feb 26 '10 at 16:17
  • The name btnI comes from Google. – SLaks Feb 26 '10 at 16:23

The URL you'd need is:


where "SEARCHTERM" is the keyword you search for.

| improve this answer | |

Try this:


Replace "the+royal+family" with your url encoded search term.

| improve this answer | |
  • It's been a while but in case it helps other users... If you want to use this in Firefox keyword.URL setting for instance, you have to let the &q parameter at the end of the url, this way : http://www.google.com/search?btnI=I&q= – pabuisson Mar 5 '13 at 20:37

Try the following syntaxes:

1. http://www.google.com/search?q=stackoverflow&btnI

But sometimes it's not predictable and it's giving you search results instead.

2. http://www.google.com/webhp?#q=stackexchange+feeling+lucky&btnI

But sometimes you'll see some source code appearing in the second example, but you can ignore it.

btnI parameter is for Google Instant Enabled and btn is for Google Instant Disabled.

| improve this answer | |

You can also put the query at the end:


| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy