How would I strip the referer to get the google search word

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
MrSpam
Forum Newbie
Posts: 3
Joined: Thu Jan 13, 2005 9:40 am

How would I strip the referer to get the google search word

Post by MrSpam »

So far I have (referer is set, dont worry)

Code: Select all

$forum_propertiesї'google_log'] = 1;
	##q=keyword& - generally all searches are encased like this
function google_refers($referer)
	{global $forum_properties;
	
	if($forum_propertiesї'google_log'] == 1) {
	$address = str_replace('http://', '', $refer);
	$address = str_replace('', '', $address);
	
	
	
	}
}
Then I stopped and though that regex would be a better choice, or not?

Im just not sure how I should go about it, HELP
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

use both of the following functions.
http://php.net/parse_url
http://php.net/parse_str
MrSpam
Forum Newbie
Posts: 3
Joined: Thu Jan 13, 2005 9:40 am

Post by MrSpam »

Ah thanks alot :D It works excellently.
Post Reply