What the hell??!? (blah, blah of a wannabe alien)
I Need To Be More Dorky
I just realized that it’s been weeks since I had something dorky to say (like programming or something to do with MySQL for example).
Just so you know that I am still dorky, here’s some PHP code for you (from my post over here)…
This will put the keywords that someone searched on to reach your site (works with Yahoo, AOL, MSN and Google) into the $keywords variable.
[code=php]$parse = parse_url($_SERVER['HTTP_REFERER']);
$se = $parse["host"];
$raw_var = explode("&", $parse["query"] );
foreach ($raw_var as $one_var) {
$raw = explode("=", $one_var);
$var[$raw[0]] = urldecode ($raw[1]);
}
$se = explode (".", $se);
switch ($se[1]) {
case 'yahoo':
$keywords = $var['p'];
break;
case 'aol':
$keywords = $var['query'];
break;
default:
$keywords = $var['q'];
}
unset($parse, $se, $raw_var, $one_var, $var);[/code]
Weeeeeeeeeee! Can I go to bed now?
| Print article | This entry was posted by Shawn on December 28, 2005 at 1:06 am, and is filed under Coding. Follow any responses to this post through RSS 2.0. You can leave a response or trackback from your own site. |
about 6 years ago
If you need more SE’s then here’s a bit of code from my scripts:
[code=php]//** This part is the distinction for the search engine used to create the parameter string
if(substr_count($l_strReferrer,"google") || substr_count($l_strReferrer,"msn") || substr_count($l_strReferrer,"wanadoo") || strpos($l_strReferrer,"altavista"))
$l_strDelimiter = "q=";
elseif(substr_count($l_strReferrer,"yahoo"))
$l_strDelimiter = "p=";
elseif(substr_count($l_strReferrer,"aolsearch.aol") || substr_count($l_strReferrer,"hotbot"))
$l_strDelimiter = "query=";
elseif(substr_count($l_strReferrer,"uknetguide"))
$l_strDelimiter = "Search=";
elseif(substr_count($l_strReferrer,"bellsouth"))
$l_strDelimiter = "string=";
elseif(substr_count($l_strReferrer,"mywebsearch") || substr_count($l_strReferrer,"mysearch.myway"))
$l_strDelimiter = "searchfor=";
elseif(substr_count($l_strReferrer,"shopping"))
$l_strDelimiter = "KW=";
else
$l_strDelimiter = "q="; [/code]
about 5 years ago
Blessed are those who understand what you were just talking about.
about 5 years ago
Then I guess I’m blessed haha