function getAllRubrics($prevRubrics = array(), $parserNum = 0, $usePrev = false)
 {
     require_once "ProxiesService.php";
     $proxyService = new ProxiesService();
     $resProxy = $proxyService->getRandomProxyData();
     $this->setProxyData($resProxy);
     if ($usePrev) {
         if (sizeof($prevRubrics) == 0) {
             print "Use main\n";
             list($res, $parserId) = $this->getMainSiteRubrics();
             if (PEAR::isError($res)) {
                 return array();
             }
         } else {
             print "Use previous\n";
             $res = $prevRubrics;
             $parserId = $parserNum;
         }
     } else {
         list($res, $parserId) = $this->getMainSiteRubrics();
         if (PEAR::isError($res)) {
             return;
         }
     }
     foreach ($res as $rubric) {
         print $rubric["id"] . ", " . $rubric["url"] . "\n";
         $resProxy = $proxyService->getRandomProxyData();
         $this->setProxyData($resProxy);
         $r1 = $this->getSiteRubrics1($rubric["url"], $rubric["id"], $parserId);
         if (PEAR::isError($r1)) {
             continue;
         }
         foreach ($r1 as $rubric1) {
             print $rubric1["id"] . ", ";
             $r2 = $this->getSiteRubrics2($rubric1["url"], $rubric1["id"], $parserId);
         }
         if ($usePrev) {
             break;
         }
         print "\n";
     }
     if ($usePrev) {
         array_shift($res);
         return $res;
     }
 }
// ƒл¤ YellowPages1ContentGrabber запускать скрипт c параметрами 1 1
$parserId = StateUtils::getProcessNum() + 1;
if ($parserId == 1) {
    $Parser =& new YellowPagesContentGrabber();
} else {
    $Parser =& new YellowPages1ContentGrabber();
}
$Parser->showInfo = false;
$Parser->waitBeforeRequest = 3;
$rubrics =& new RubricsData();
$Parser->rubricsData =& $rubrics;
$ProxyService = new ProxiesService();
$start = (int) FileUtils::loadContents(CALC_START_ID);
$subRubrics = $rubrics->getSubRubricsForParser($parserId, $start, 1);
if (PEAR::isError($subRubrics)) {
    print $subRubrics->getMessage();
    exit;
}
if ($subRubrics->numRows() == 0) {
    // —брос счетчика последнего обработаной записи
    FileUtils::saveContents(CALC_START_ID, "0");
    exit;
}
while ($row =& $subRubrics->fetchRow(DB_FETCHMODE_OBJECT)) {
    $res = $ProxyService->getRandomProxyData();
    $Parser->setProxyData($res);
    $res = $Parser->getRealNum($row->rurl);
    $rubrics->setRealNum($res, $row->rid);
    print $row->rid . ", " . $row->rurl . ": " . $res . "\n";
    FileUtils::saveContents(CALC_START_ID, $row->rid);
}
function HandleHighlighting($useProxy = true)
{
    $params = array();
    if ($useProxy) {
        $proxyService = new ProxiesService();
        $res = $proxyService->getRandomProxyData();
        if (PEAR::isError($res)) {
            return $res;
        }
        $params["proxyData"] = $res;
    }
    $content = UrlUtils::loadPage($_REQUEST["url"], $params);
    print <<<HTML
<html>
<title>Подсветка {$_REQUEST["url"]}</title>
<head>
<style>
em { color: red; font-size: 12pt; font-weight: bold; }
pre { font-size: 9pt; }
b { color: blue; }
b b { color: red; }
</style>
</head>
<body>
<pre>
HTML;
    print getHighlitedHtml($content);
    print <<<HTML
</pre>
</body>
</html>
HTML;
}