]*[Hh][Rr][Ee][Ff][^=]*=[ '\"\s]*([^ \"'>\s#]+)[^>]*>/", $html, $matches); $urls = $matches[1]; // Берём то место, где сама ссылка (благодаря группирующим скобкам в регулярном выражении) /* Выводим все ссылки */ for ($j = 0; $j < count($urls); $j++){ $link=$urls[$j]; if (findtxt($link, 'https://mallstroy.ru')==0) $link = 'https://mallstroy.ru' . leopak($link); // echo $link . "\n"; $id=DB::getValue("SELECT `id` FROM `krov` WHERE `link` LIKE '%" . $link . "' LIMIT 1"); if (!$id)DB::add("INSERT INTO `krov` (`link`, `status`) VALUES (?, ?)", array($link, 1)); } } function get_page($link){ $agent = 'Mozilla/5.0 (compatible; YandexBot/3.0)'; $ch = curl_init($link); //curl_setopt($ch, CURLOPT_REFERER, 'https://www.samsonopt.ru'); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 20); curl_setopt($ch, CURLOPT_TIMEOUT, 20); //timeout in seconds curl_setopt($ch, CURLOPT_USERAGENT, $agent); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $dir = dirname(__FILE__); $config['cookie_file'] = $dir . '/cookies/' . md5(@$_SERVER['REMOTE_ADDR']) . '.txt'; curl_setopt($ch, CURLOPT_COOKIEFILE, $config['cookie_file']); curl_setopt($ch, CURLOPT_COOKIEJAR, $config['cookie_file']); curl_setopt($ch, CURLOPT_COOKIE, "PMBC=96152e8e9a0168a731539c5e52c6b39a; PHPSESSID=jl0i13pn3157qca807jgp0jqa7; ServerName=WoW+Circle+3.3.5a+x5; serverId=1"); // curl_setopt($ch, CURLOPT_PROXY, 'localhost:9050'); // Use if proxy have username and password // curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5); //curl_close($ch); $response_data[0] = curl_exec($ch); $response_data[1]= curl_getinfo($ch, CURLINFO_RESPONSE_CODE); //echo $response_data[1] . "\n"; // if (curl_errno($ch) > 0) { // die('Ошибка curl: ' . curl_error($ch)); //} curl_close($ch); return $response_data; } //exec ("php /home/cloud/core/parcer/r2.php"); //DELETE FROM table WHERE id NOT IN (SELECT max(id) FROM table GROUP BY name HAVING count(id)>1) //DELETE FROM `sm` WHERE `id` NOT IN (SELECT max(`id`) FROM `sm` GROUP BY `link` HAVING count(`id`)>1)`status`=1 AND $LinkList = DB::getAll( 'SELECT * FROM `krov` WHERE `link` NOT LIKE "%.jpg" ORDER BY RAND() LIMIT ' . $argv[1]); for ($i=0; $i