This code is very useful when you want to show the users posts related to their search. Some blog would show pop ups at the bottom using these search terms and will take users to other posts of their blog. Here is a code snippet to get the search terms of your users.
<?php <br ?> $refer = $_SERVER["HTTP_REFERER"]; if (strpos($refer, "google")) { $refer_string = parse_url($refer, PHP_URL_QUERY); parse_str($refer_string, $vars); $search_terms = $vars['q']; echo 'Welcome Google visitor! You searched for the following terms to get here: '; echo $search_terms; }; ?>