PHP Script to Identify and Echo Search Engine Terms

I wanted a PHP script that could identify the keywords someone used when searching for my site on a search engine, and then display those keywords on my webpage. For example, my page would say this:
If you were searching for keyword1 keyword2, you’ve come to the right place.
The code shouldn’t be too difficult, unless you […]