Please wait, loading...

 

Get Users' Search Terms - Emerald Tech

February 27, 20120

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;
};
?&gt;

Yumna Tatheer

Leave a Reply

Your email address will not be published. Required fields are marked *

Copyright @ Yamna Tatheer CEO Emerald Technologies Registration Number: 3520166158082