I'm trying to track where my visiters are coming from so i have this code... which adds it to a sql database..
problem is i get real long url's IE people seaching google ect. how can i make them shorter??? like www.google.com???
$ref = $_SERVER['HTTP_REFERER'];
<?php $pattern = "/http:\/\/([a-z0-9_]*\.[a-z0-9.]*\.[a-z]{2,4})\//i"; preg_match($pattern, $_SERVER['HTTP_REFERER'], $referer); print_r($referer[1]); ?>
~Brett
<?php $pattern = "/http:\/\/([a-z0-9_]*\.[a-z0-9.]*\.[a-z]{2,4})\//i"; preg_match($pattern, $_SERVER['HTTP_REFERER'], $referer); print_r($referer); ?>
Or use [man]parse_url/man to get the host.