Captured Searched Terms with PHP?

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
User avatar
uberdragon
Forum Newbie
Posts: 11
Joined: Thu Apr 27, 2006 8:54 am
Location: Farmington, CT

Captured Searched Terms with PHP?

Post by uberdragon »

Hello,

I have a client that would like me to write a PHP application that will capture the terms that were searched for from the referrer (ie google) and then send that information to administration when they submit a contact form. Enabling them to automatically know which search term has resulted in the form submission.

I know log analyzers such as awstats etc is able to track what search terms brought traffic to the site. My question is:

How can I capture this information with PHP?

Any help is greatly appreciated!
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Post by s.dot »

If it's set, $_SERVER['HTTP_REFERER'] will contain the URI of the referring page.
php.net wrote:'HTTP_REFERER'

The address of the page (if any) which referred the user agent to the current page. This is set by the user agent. Not all user agents will set this, and some provide the ability to modify HTTP_REFERER as a feature. In short, it cannot really be trusted.
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
User avatar
uberdragon
Forum Newbie
Posts: 11
Joined: Thu Apr 27, 2006 8:54 am
Location: Farmington, CT

Post by uberdragon »

Ah.. just tested it...


Atleast with google the search parameters are in the string that will work.

Now to write a function to parse the url :)
nickvd
DevNet Resident
Posts: 1027
Joined: Thu Mar 10, 2005 5:27 pm
Location: Southern Ontario
Contact:

Post by nickvd »

uberdragon wrote:Ah.. just tested it...


Atleast with google the search parameters are in the string that will work.

Now to write a function to parse the url :)
A function similar to parse_url()? ;)
Post Reply