function getLinkCount($urlFrom, $urlTo) { $urlFrom = UrlUtils::removeWWW($urlFrom); $urlTo = UrlUtils::removeWWW($urlTo); $res = $this->grabbCount($urlTo, $urlFrom); $num = $res["num"]; $searcher = $res["url"]; $res = $this->grabbCount("www." . $urlTo, $urlFrom); if ($num < $res["num"]) { $num = $res["num"]; $searcher = $res["url"]; } $res = $this->grabbCount($urlTo, "www." . $urlFrom); if ($num < $res["num"]) { $num = $res["num"]; $searcher = $res["url"]; } $res = $this->grabbCount("www." . $urlTo, "www." . $urlFrom); if ($num < $res["num"]) { $num = $res["num"]; $searcher = $res["url"]; } return "<a target='_blank' href='{$searcher}'\n\t\t\ttitle='Links count from {$urlFrom} to {$urlTo}'>{$num}</a>"; }
function getParserDataFromUrl($url) { if ($this->db == null) { return new PEAR_Error("DB Connect error."); } $u = parse_url($url); if (!isset($u["host"])) { return -1; } $u = UrlUtils::removeWWW($u["host"]); $sql = "SELECT * FROM parsers WHERE url LIKE '%{$u}%' LIMIT 1"; $res =& $this->db->getRow($sql, array(), DB_FETCHMODE_OBJECT); return $res; }
function findUrl($url, $link) { $filtered = ""; $link = strtolower(UrlUtils::removeWWW(str_replace("http://", "", $link))); $contents = $this->loadPage($url); $pattern = "{<a[^>]+?(href=\".+?\"|href='.+?'|href=.+?\\s)[^>]*>(.+?)</a>}si"; if (!preg_match_all($pattern, $contents, $matches, PREG_SET_ORDER)) { return $filtered; } foreach ($matches as $match) { $src = strtolower(StrUtils::removeQuotes(substr($match[1], 5))); $src = parse_url($src); $src = UrlUtils::removeWWW($src["host"]); if (strcmp($src, $link) == 0) { $filtered = StrUtils::cleanString($match[2]); break; } else { if (strpos($src, $link) !== false) { $filtered = StrUtils::cleanString($match[2]); } } } return $filtered; }