$Rubrics->setLoaded($Parser->id, true, $Parser->processId); //$Rubrics->freeRubric($Parser->id); } //$Parser->_IContentGrabber(); } } if (StateUtils::isBusy(BUSYSTAT_FILE)) { print "Is busy\n"; exit; } StateUtils::setBusy(BUSYSTAT_FILE); register_shutdown_function("onShutdown"); $ProxyService = new ProxiesService(); $Rubrics =& new RubricsData(); // Восстановить состояние - если было сохранено $Parser = StateUtils::load(PARSERSTATE_FILE); if ($Parser == null) { print "Use new.\n"; $res = $ProxyService->getRandomProxyData(); //print_r($res); $nextRubric = $Rubrics->getRubric(); if (PEAR::isError($nextRubric)) { print $nextRubric->getMessage(); exit; } if (!isset($nextRubric)) { print "No have data for loading.\n"; } //print_r($nextRubric); $parserName = $nextRubric->parser_name . "ContentGrabber"; $Parser =& new $parserName();
if (StateUtils::isBusy(BUSY_FILENAME)) { print "Is busy\n"; exit; } StateUtils::setBusy(BUSY_FILENAME); register_shutdown_function("onShutdown"); $baseUrl = "http://direct.yandex.ru/stat/wordsstat.pl"; // указываем имя сервиса и ip-сервера откуда скрипт запускается $proxyService = new ProxiesService("yandex", "194.186.45.242"); $res = $proxyService->getProxyData(); if (PEAR::isError($res)) { print $res->getMessage(); exit; } $queries = null; $parser = StateUtils::load(STATE_FILENAME); var_dump($parser); if ($parser == null) { // Получить запрос $queries = $db->getAll(CMD_SEL_QUERIES, array(), DB_FETCHMODE_ASSOC); if (PEAR::isError($queries)) { print $queries->getMessage(); exit; } if (!isset($queries) || sizeof($queries) == 0) { print "All data is processed.\n"; exit; } var_dump($queries); $parser =& new ResearchGrabber(); $parser->waitBeforeRequest = WAIT_BEFORE_REQUEST;