Exemple #1
0
 function processPage($pageContent)
 {
     try {
         $links = array();
         $html = str_get_html($pageContent);
         //reparam html stricat
         if (!$html->find('body', 0, true)) {
             $html = $this->fixHtml($html);
         }
         $body = $html->find('body', 0, true);
         $this->extractText($body);
         foreach ($body->find("a") as $link) {
             $links[] = $link->href;
         }
         //cata memorie consuma
         //si eliberare referinte pierdute
         $html->clear();
         MemoryManagement::showUsage('before cleaning', true, 'KB');
         MemoryManagement::clean(true);
         MemoryManagement::showUsage('after cleaning', true, 'KB');
         return $links;
     } catch (Exception $ex) {
         Applog::exceptionLog($ex);
     }
 }
 function start()
 {
     Applog::log("INSIDE " . __FILE__ . ' - ' . __CLASS__ . '::' . __FUNCTION__ . '() - ' . 'line ' . __LINE__, 4);
     while (($file = $this->getNextFile()) != null) {
         $this->processFile($file);
         MemoryManagement::clean();
     }
     Applog::log("Finished");
 }