Re: stripping the keywords from a search engine... again...

From: Date: Thu, 18 Jan 2001 07:56:14 +0000
Subject: Re: stripping the keywords from a search engine... again...
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-35299@lists.php.net to get a copy of this message
Hello Dallas, (DK == "Dallas Kropka") dallask@austin.rr.com writes: DK> Posted earlier but got no response.... so here it is again... I gave you a quick explanation of one way to do it earlier, but I know of no tutorials off the top of my head. Here is a lengthy example if you _have_ to see code: <?php $URI = 'http://www.altavista.com/cgi-bin/query?q=foo+and+bar+and+baz&kl=XX&pg=q&Translate=on'; /* the above would obviously be $HTTP_REFERER */ /* I typed in 'foo and bar and baz' */ $parts = explode('?',$URI); $query = explode('&',$parts[1]); $terms = explode('=',$query[0]); $keywords = explode('+',$terms[1]); print 'They used: <br>'; while(list(,$keyword) = each($keywords)) { print "$keyword<br>"; /* still going to print 'and' and 'or' and 'not' and .. */ } ?> But there has to be an easier solution out there that's already been ridden to death. The above is going to get nasty rather quickly I'd imagine, and every search engine, more than likely, is going to have a completely different query string. There's no way I'm going to look. :) I wouldn't reinvent the wheel; go do some searching, poke through someone's "stats" code. I'm sure this has been done before in PHP, and I _know_ it's been done in Perl -- which is fairly easy to translate. -Brian -- A)bort, R)etry, I)gnore, V)alium?

« previous php.general (#35299) next »