function getSiteRubrics2($url, $parentId = 0, $parserId = 0) { $logger =& Log::singleton("file", "results.log", __FUNCTION__); $logger->log($parentId . ": " . $url); $contents = $this->loadPage($url); $pattern = '{ <div class="catalog"> <a href="([^"]+)">(.+?)</a> .+? </div> }si'; $pattern = preg_replace("{\\s+}", "\\s*", $pattern); if (preg_match_all($pattern, $contents, $matches, PREG_SET_ORDER)) { $res = array(); foreach ($matches as $m) { $url = UrlUtils::getRealUrl($url, StrUtils::cleanString($m[1])); $url = UrlUtils::removeQuery($url); $id = $this->rubricsData->addRubric($url, StrUtils::cleanString($m[2]), -1, $parserId, true, $parentId, 2); if (!PEAR::isError($id)) { $res[] = array("id" => $id, "url" => $url); } } $logger->log(print_r($res, true)); return $res; } else { $logger->log("Rubrics2 for {$url} not found."); return new PEAR_Error("Rubrics2 for {$url} not found."); } }