Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Sameer Borate's Blog:
Grabbing the referrer search engine keywords for a site
Oct 18, 2011 @ 18:25:27

On his blog today Sameer Borate has a new post with a handy bit of code you can use to find the keywords from a search engine referral to help with tracking how visitors have come to your site.

A couple of weeks back I had to write a solution for a client to track the referrer search engine from where the user came to his sites contact page, without using Google Analytics. If a user was to fill the contact form on the website, the referring search engine name and the keyword for which it was refereed was to be emailed along with the contact information. The following is a solution for the same.

The code itself is pretty simple - it checks the $_SERVER['HTTP_REFERER'] and, based on an array of search engine types, looks for a certain "query" keyname in the URL and matches what follows (with a regular expression). This can be useful for not only determining what sort of audience is visiting your site, but could also be used to present a custom message to visitors from certain search engines (or, more complicated, to show different content based on search terms).

tagged: search engine keyword referrer url snippet

Link:

PHPro.org:
Tutorial - Reciprocal Links
Oct 28, 2008 @ 17:52:19

Kevin Waterson has posted a new tutorial to the PHPro.org website today stepping you through the automation of handing reciprocal links.

This tutorial looks at the process of reciprocal links. That is, links generated from websites that have links to your own page. These links back to a page can be detected from the HTTP REFERER which, in PHP, can be detected via the super global variable $_SERVER['HTTP_REFERER']. Care should be taken when using this variable as it is set from userland and, as such, should not be trusted.

His method stores the linking information (gathered from the referrer) and calls an addLinks method that checks to ensure the page format is valid and that it's a real site before putting it into the table. Complete code for this, a fetch method and a simple database layer to put it on top of are included.

tagged: reciprocal links tutorial class validate domain referrer

Link:

Mpwebwizard.com:
Use a mirror for hits from popular websites
Dec 18, 2006 @ 21:49:00

There's a tutorial over on mpwebwizard.com that's been updated and talks about using a mirror to handle hits from a popular website (like digg or slashdot).

caching services such as coral content distribution network provide an alternative for when your site goes down, but why wait until it gets to that stage? why not just send all your hits from high-end websites to the coral cache version? well, there isn't a good reason not to, so i'll show you how to do it automatically.

He provides the simple script that looks for certain sites in the "HTTP_REFERER" value of incoming calls and pushes them off to the cached location with a header() redirect. The whole thing is only 12 lines, not counting the $sites array.

tagged: mirror automatically tutorial coral content distribution network referrer mirror automatically tutorial coral content distribution network referrer

Link:

Mpwebwizard.com:
Use a mirror for hits from popular websites
Dec 18, 2006 @ 21:49:00

There's a tutorial over on mpwebwizard.com that's been updated and talks about using a mirror to handle hits from a popular website (like digg or slashdot).

caching services such as coral content distribution network provide an alternative for when your site goes down, but why wait until it gets to that stage? why not just send all your hits from high-end websites to the coral cache version? well, there isn't a good reason not to, so i'll show you how to do it automatically.

He provides the simple script that looks for certain sites in the "HTTP_REFERER" value of incoming calls and pushes them off to the cached location with a header() redirect. The whole thing is only 12 lines, not counting the $sites array.

tagged: mirror automatically tutorial coral content distribution network referrer mirror automatically tutorial coral content distribution network referrer

Link:


Trending Topics: