badclasses); } function descramble ($matches) { return @in_array($matches[1],$this->badclasses[1])?'':$matches[2]; } function stats ($site, $section = 4, $item = 5) { if (!is_array($this->cache[$site])) { $items = array(); $html = preg_replace('# #','',preg_replace('#(?:<|<)!--.+?--(?:>|>)#','',file_get_contents('http://www.alexa.com/data/details/traffic_details/' . $site))); preg_match_all('#.+?#',$html,$tables); for ($i=0,$len=count($tables[0]); $i<$len; $i++) { preg_match_all('#(.+?)#',$tables[0][$i],$info); for ($i2=0,$len2=count($info[1]); $i2<$len2; $i2++) { $info[1][$i2] = preg_replace('#(\w+)#','$1 ',$info[1][$i2]); $items[$i][] = preg_replace_callback('#(.+?)#im',array(get_class($this), 'descramble'),$info[1][$i2]); } } $this->cache[$site] = $items; } if ($section == 4 && $item == 5) { return $this->cache[$site]; } elseif ($item == 5) { return $this->cache[$site][$section]; } else { return $this->cache[$site][$section][$item]; } } function threeMothAlexa($site) { $urlinfo=parse_url($site); $site=$urlinfo["host"]; $score=$this->stats($site,1); return $score[2]; } } // //$alexa = new AB_Alexa(); //print_r($alexa->stats('http://www.pkphp.com')); //print_r($alexa->stats('http://www.pkphp.com',1)); //print_r($alexa->stats('http://www.pkphp.com',1,1)); //print_r($alexa->threeMothAlexa('http://www.pkphp.com'));