get_results("SELECT url_adress FROM seo_statistics WHERE processed = 0 LIMIT 15", ARRAY_A); $urls = ''; $urls_cl = ''; function parser($urls_cl, $folder) { try { $file = shell_exec($folder.'phantomjs --proxy=213.136.69.195:10000 --proxy-type=http --proxy-auth=user1:7dDHnhPI '.$folder.'server.js ' . $urls_cl . ' evernote-results.html'); //parsing page $block_all = preg_match_all("|(
)(.*)()|ismU", $file, $matches); array_splice($matches, 1); foreach ($matches as $value) { $value_p = $value; } return $value_p; flush(); } catch (Exception $exc) { echo('Ошибка!'); echo $exc->getTraceAsString(); } } if ($results_urls) { //create a link for parsing $i = 0; foreach ($results_urls as $value_urls) { //keywords /* $urls .= (($i % 5 == 0) ? 'plot/line/year//' : ''); $urls .= $value_urls['url_adress'] . '/us/Or/'; */ //traffic $urls .= (($i % 5 == 0) ? 'plot/line/year//' : ''); $urls .= $value_urls['url_adress'] . '/us/Ot/'; $i++; } $urls_cl = 'https://ru.semrush.com/info/history/index.html/' . substr($urls, 0, -1); //echo $urls_cl; //final page parsing and block parsing and saving to the database foreach (parser($urls_cl, $elemetns['loc_folder']) as $valuevv) { $site_name = preg_match_all("|()(.*)()|ismU", $valuevv, $matchesvv); $count_all = preg_match_all("|()(.*)()|ismU", $valuevv, $matchesv); //echo '
' . strip_tags($matchesvv['0']['0'] . ' - ' . $matchesv['0']['0'] . '
', '
'); $db->query('UPDATE seo_statistics SET views = "' . $db->escape(str_replace(',', '', strip_tags($matchesv['0']['0']))) . '", processed = 1 WHERE url_adress = "' . $db->escape(strip_tags($matchesvv['0']['0'])) . '"'); } } else { } echo '

';