Forum Moderators: coopster
list(,$querystring) = split("\?", $querystring); list(,$querystring) = array_pad(split("\?", $querystring),2,null); function google ($ques, $querystring, $referer, $url)
{
$patterns = array('/www\./', '/\.com/' , '/\.co/', '/google\./');
$replacements = array('', '', '', '');
list(,$querystring) = array_pad(split("\?", $querystring),2,null);
$v2 = preg_replace("/^([^\&]+\&)*$ques=([^\&]*)(\&[^\&]+)*$/", "$2", $querystring);
// check for google.com/google.co.country/google.com.country/google.country with or without www .
$country = preg_replace($patterns, $replacements, $url);
// (country == 'google') => non-country case, www.google.com/google.com
if ($country == "google") $country = "US";
return array($v2, $referer . "-$country");
} $url = preg_replace("|https?://([^\/]+)/.*|", "$1", $_SERVER['HTTP_REFERER']);
$nonurl = preg_replace("|https?://([^\/]+)/(.*)|", "$2", $_SERVER['HTTP_REFERER']) I went after a notice that said: Undefined offset: 1
list(,$querystring) = array_pad(split("\?", $querystring),2,null);
$querystring = parse_url($querystring, PHP_URL_QUERY);
My limited knowledge tells me that https:// should be a part of that regex line in the $patterns = array
...except that from time to time it will throw in the https:// from parsed URL.
...how can I ensure that http(s):// part does not show up?