It's been a little while since I have done some hard out coding (since my end of year exams in November '11) and was thinking about what's in the subject line yesterday - how do you gather the search terms that were typed into Google/Yahoo/Bing etc and display on a page of your site something like "You have found 123 results for the search term 'Stack Overflow Programming', browse the results below".
I have seen this alot on torrenting sites and meta search engines. I have done a years worth of PHP programming but this one I am unsure about. I was thinking that somewhere in the code you might need a GET['search'] query. I would redirect all results/links found to a single URL (I can do that thanks to .htaccess) and open the "found" link in a new window.
I have tried searching for something like this in Google but couldn't think of a short and tight enough search term that would yield the best results. Is it possible to use the Google/Bing/Yahoo API's and manipulate them slightly to get the desired results? Some guidance would be good :).
Cheers and thanks in advance!
You do this by reading the HTTP Referer
header (yes, it is misspelled).
This is totally under the user's control - they can make it say whatever they like. But, if they use an unmodified browser and come from a non-SSL Google search page, then you will see the URL they used to search Google as the source. That URL includes the query string, from which you may extract the search terms.