diff --git a/RankChecker.class.php b/RankChecker.class.php index 7b31f69..d80def6 100644 --- a/RankChecker.class.php +++ b/RankChecker.class.php @@ -15,9 +15,10 @@ public function __construct($start = 1, $end = 2) $this->end = $end; } - public function find($keyword, $useproxie, $proxies) + public function find($keyword, $domain, $useproxie, $proxies) { - $results = []; + $results = []; + $rank = 0; for ($start = ($this->start-1) * 10; $start <= $this->end * 10; $start += 10) { $ua = [ @@ -101,10 +102,14 @@ public function find($keyword, $useproxie, $proxies) $i = 1; while (($j = stripos($data, '', $j+1)) !== false) { + $rank = $i++; $k = stripos($data, '', $j); $link = strip_tags(substr($data, $j, $k-$j)); - $rank = $i++; - $results[] = ['rank' => $rank, 'url' => $link]; + + //If domain is set, check only the specified domain + if( (!empty($domain) && strstr($link, $domain)) || empty($domain) ){ + $results[] = ['rank' => $rank, 'url' => $link]; + } } } } @@ -116,6 +121,7 @@ public function find($keyword, $useproxie, $proxies) return $results; } + private function _isCurlEnabled() { return function_exists('curl_version');