Помощь по скриптам | Помогите спарсить сайт!
PhpStorm (19.07.2018 в 13:34)
V0L4OK (19.07.2018 в 13:01)
Banned ip address нужно где-то ввести ip данного vds или хостинга
надпись гласит, что владелец сайта-жертвы банит ваш ip
сайт похоже через CloudFlare работает и включен режим - под атакой
V0L4OK (19.07.2018 в 13:01)
Banned ip address нужно где-то ввести ip данного vds или хостинга
надпись гласит, что владелец сайта-жертвы банит ваш ip
сайт похоже через CloudFlare работает и включен режим - под атакой
То есть гиблое дело выходит?? Обойти никак ??
99510869 (19.07.2018 в 13:35)
d1nka , Вставляю не помогает, та же ошибка.
d1nka , Вставляю не помогает, та же ошибка.
не может быть
d1nka , Может.Проверено уже, действия (чистка истории браузера+установка прокси socks5) = Ошибка.
DELETED
19 июля 2018, в 13:59
Delete
99510869 (19.07.2018 в 13:36)
PhpStorm (19.07.2018 в 13:34)
V0L4OK (19.07.2018 в 13:01)
Banned ip address нужно где-то ввести ip данного vds или хостинга
надпись гласит, что владелец сайта-жертвы банит ваш ip
сайт похоже через CloudFlare работает и включен режим - под атакой
То есть гиблое дело выходит?? Обойти никак ??
PhpStorm (19.07.2018 в 13:34)
V0L4OK (19.07.2018 в 13:01)
Banned ip address нужно где-то ввести ip данного vds или хостинга
надпись гласит, что владелец сайта-жертвы банит ваш ip
сайт похоже через CloudFlare работает и включен режим - под атакой
То есть гиблое дело выходит?? Обойти никак ??
не знаю, особенно если ещё в придачу и платный аккаунт у чела на CloudFlare
PhpStorm , Ясно, Блин. Спасибо большое за ответ.
DELETED
19 июля 2018, в 14:05
Delete
99510869 (19.07.2018 в 14:01)
PhpStorm , Ясно, Блин. Спасибо большое за ответ.
PhpStorm , Ясно, Блин. Спасибо большое за ответ.
Name Server: MARIO.NS.CLOUDFLARE.COM
Name Server: KIKI.NS.CLOUDFLARE.COM
сайт под защитой Cloudflare https://ru.wikipedia.org/wiki/Cloudflare
99510869 , Попробуй врубить куки, и юзать curl, если клоуд фришный, можно обойти
null , Либо я что-то не то делаю либо фиг его но не выходит у меня ничего. Скрипт вырван с парсера кинопоиск.
[code]
<?php
define('DEBUG', false);
$debug = array();
if (DEBUG) {
@error_reporting(E_ALL ^ E_WARNING ^ E_NOTICE);
@ini_set('error_reporting', E_ALL ^ E_WARNING ^ E_NOTICE);
@ini_set('display_errors', true);
@ini_set('html_errors', true);
} else {
@error_reporting(E_ERROR);
@ini_set('error_reporting', E_ERROR);
@ini_set('display_errors', true);
@ini_set('html_errors', false);
}
@ini_set('max_execution_time', '1800');
@set_time_limit(1800);
if (get_magic_quotes_runtime()) {
set_magic_quotes_runtime(false);
}
$d= $_POST['url'];
if($d){
$h = '1';
}
$tio = isset($h) ? intval($h) : false;
$tio = floor(lcg_value() * (999 - 2) + 2);
file_get_contents('C:\/OSPanel\/domains\/kinopoisk\/config.php');
//Функция вывода на экран
function printData($json, $error = false)
{
global $debug, $parser;
@header('Content-Type: text/html; charset=UTF-8');
if (!$error) {
if (is_string($json)) {
$json = array('text' => $json);
}
if (DEBUG) {
$json['debug'] = $debug;
if (isset($parser->debug_list)) {
$json['debug_parser'] = $parser->debug_list;
}
}
$json = json_encode($json);
if (DEBUG and function_exists('json_last_error') and json_last_error()) {
$json = array(
'debug_json' => json_last_error()
);
$json = json_encode($json);
}
//echo $json;
} else {
$json = array('text' => '<span style="color: red;">'.$json.'</span>');
//echo json_encode($json);
set_file_info('delete');
exit;
}
}
/**
* Введите информацию о статусе
* @Строка param @info
* @обратная смесь
*/
//установить информацию о файле
function set_file_info($info)
{
global $tio;
if (!$tio) {
return false;
}
if ($info == 'delete') {
@unlink('./cache/pkinopoisk_tio_'.$tio.'.tmp');
} elseif ($info) {
if (file_exists('./cache/pkinopoisk_tio_'.$tio.'.tmp')) {
$info = '<br />'.$info;
}
$fh = fopen('./cache/pkinopoisk_tio_'.$tio.'.tmp', 'a+');
fwrite($fh, $info);
fclose($fh);
}
}
/**
* Преобразование кодировки в utf-8
* @Параметр строки $ data
* @Параметр строки $from
* @Параметр строки $to
* @строка возврата
*/
function convert_charset_pkp($data, $from = 'cp1251', $to = 'utf-8')
{
if ($from == $to) {
return $data;
} elseif (function_exists('mb_convert_encoding')) {
$data = mb_convert_encoding($data, $to, $from);
} elseif (function_exists('iconv')) {
$data = iconv($from, $to.'//IGNORE', $data);
}
return $data;
}
/**
* Заменяем ASCII код в соответствующий html спец. код
* @param string $text
* @return string
*/
function convert_charset_ascii_to_code($text)
{
//http://easywebscripts.net/html/ascii.php
$sc = array('"', '&', '~', '‚', '„', '†', '‡', '‰', '‹', '‘', '’', '“', '”', '–', '—', '˜', '™', '›', 'Ÿ', ' ', '¡', '¢', '£', '¤', '¥', '¦', '§', '¨', '©', 'ª', '«', '¬', '', '®', '¯', '°', '±', '²', '³', '´', 'µ', '¶', '·', '¸', '¹', 'º', '»', '¼', '½', '¾', '¿', 'À', 'Á', 'Â', 'Ã', 'Ä', 'Å', 'Æ', 'Ç', 'È', 'É', 'Ê', 'Ë', 'Ì', 'Í', 'Î', 'Ï', 'Ð', 'Ñ', 'Ò', 'Ó', 'Ô', 'Õ', 'Ö', '×', 'Ø', 'Ù', 'Ú', 'Û', 'Ü', 'Ý', 'Þ', 'ß', 'à', 'á', 'â', 'ã', 'ä', 'å', 'æ', 'ç', 'è', 'é', 'ê', 'ë', 'ì', 'í', 'î', 'ï', 'ð', 'ñ', 'ò', 'ó', 'ô', 'õ', 'ö', '÷', 'ø', 'ù', 'ú', 'û', 'ü', 'ý', 'þ', 'ÿ', '…');
$rp = array('"', '&', '˜', '‚', '&dbquo;', '†', '‡', '‰', '‹', '‘', '’', '“', '”', '–', '—', '&tilde', '™', '›', 'Ÿ', ' ', '&ixcl;', '¢', '£', '¤', '¥', '¦', '§', '¨', '©', 'ª', '«', '¬', '', '®', '¯', '°', '±', '²', '³', '&acuate;', 'µ', '¶', '·', '¸', '¹', 'º', '»', '¼', '½', '¾', '¿', 'À', 'Á', 'Â', 'Ã', 'Ä', 'Å', 'Æ', 'Ç', 'È', 'É', 'Ê', 'Ë', 'Ì', 'Í', '&Icirс;', 'Ï', 'Ð', 'Ñ', 'Ò', 'Ó', 'Ô', 'Õ', 'Ö', '×', 'Ø', 'Ù', 'Ú', 'Û', 'Ü', 'Ý', 'Þ', 'ß', 'à', 'á', 'â', 'ã', 'ä', 'å', 'æ', 'ç', 'è', 'é', 'ê', 'ë', 'ì', 'í', '&icirс;', 'ð', 'ð', 'ñ', 'ò', 'ó', 'ô', 'õ', 'ö', '÷', 'ø', 'ù', 'ú', 'û', 'ü', 'ý', 'þ', 'ÿ', '...',);
$text = str_replace($sc, $rp, $text);
return $text;
}
if (isset($_POST['id']) && $_POST['id'] == 'tio' && $tio) {
if (file_exists('/.cache/pkinopoisk_tio_'.$tio.'.tmp')) {
$time_file = @filemtime('./cache/pkinopoisk_tio_'.$tio.'.tmp');
$time_file = $time_file ? ' ('.(time() - $time_file).' сек.)' : '';
printData('<span style="color: green;">'.file_get_contents('./cache/pkinopoisk_tio_'.$tio.'.tmp').$time_file.'</span>');
} else {
printData('finish');
}
die();
}
//DLE function
@session_start();
$prefix_link_tags = 'tags/';
//Mod main
$_TIME = time() + ($config_mod['date_adjust'] * 60);
@session_write_close();
//$config_mod =
define('FOLDER_PREFIX', date("Y-m"));
$news_id = isset($_POST['news_id']) ? intval($_POST['news_id']) : 0;
$author = "igrovik";
$time_ex = time();
/*if (get_magic_quotes_gpc()) {
$_POST['film_name'] = stripslashes($_POST['film_name']);
}
$title = trim($_POST['url']);
$sact = isset($_POST['sact']) ? trim(strip_tags($_POST['sact'])) : false;
if (empty($title)) {
printData('Для поиска введите название фильма в заголовок статьи!', true);
}
*/
$config_mod['conf']['sleep'] = intval($config_mod['conf']['sleep']);
if ($config_mod['conf']['jpeg_quality'] <= 0) {
$config_mod['conf']['jpeg_quality'] = $config['jpeg_quality'];
}
if (!empty($config_
[code]
<?php
define('DEBUG', false);
$debug = array();
if (DEBUG) {
@error_reporting(E_ALL ^ E_WARNING ^ E_NOTICE);
@ini_set('error_reporting', E_ALL ^ E_WARNING ^ E_NOTICE);
@ini_set('display_errors', true);
@ini_set('html_errors', true);
} else {
@error_reporting(E_ERROR);
@ini_set('error_reporting', E_ERROR);
@ini_set('display_errors', true);
@ini_set('html_errors', false);
}
@ini_set('max_execution_time', '1800');
@set_time_limit(1800);
if (get_magic_quotes_runtime()) {
set_magic_quotes_runtime(false);
}
$d= $_POST['url'];
if($d){
$h = '1';
}
$tio = isset($h) ? intval($h) : false;
$tio = floor(lcg_value() * (999 - 2) + 2);
file_get_contents('C:\/OSPanel\/domains\/kinopoisk\/config.php');
//Функция вывода на экран
function printData($json, $error = false)
{
global $debug, $parser;
@header('Content-Type: text/html; charset=UTF-8');
if (!$error) {
if (is_string($json)) {
$json = array('text' => $json);
}
if (DEBUG) {
$json['debug'] = $debug;
if (isset($parser->debug_list)) {
$json['debug_parser'] = $parser->debug_list;
}
}
$json = json_encode($json);
if (DEBUG and function_exists('json_last_error') and json_last_error()) {
$json = array(
'debug_json' => json_last_error()
);
$json = json_encode($json);
}
//echo $json;
} else {
$json = array('text' => '<span style="color: red;">'.$json.'</span>');
//echo json_encode($json);
set_file_info('delete');
exit;
}
}
/**
* Введите информацию о статусе
* @Строка param @info
* @обратная смесь
*/
//установить информацию о файле
function set_file_info($info)
{
global $tio;
if (!$tio) {
return false;
}
if ($info == 'delete') {
@unlink('./cache/pkinopoisk_tio_'.$tio.'.tmp');
} elseif ($info) {
if (file_exists('./cache/pkinopoisk_tio_'.$tio.'.tmp')) {
$info = '<br />'.$info;
}
$fh = fopen('./cache/pkinopoisk_tio_'.$tio.'.tmp', 'a+');
fwrite($fh, $info);
fclose($fh);
}
}
/**
* Преобразование кодировки в utf-8
* @Параметр строки $ data
* @Параметр строки $from
* @Параметр строки $to
* @строка возврата
*/
function convert_charset_pkp($data, $from = 'cp1251', $to = 'utf-8')
{
if ($from == $to) {
return $data;
} elseif (function_exists('mb_convert_encoding')) {
$data = mb_convert_encoding($data, $to, $from);
} elseif (function_exists('iconv')) {
$data = iconv($from, $to.'//IGNORE', $data);
}
return $data;
}
/**
* Заменяем ASCII код в соответствующий html спец. код
* @param string $text
* @return string
*/
function convert_charset_ascii_to_code($text)
{
//http://easywebscripts.net/html/ascii.php
$sc = array('"', '&', '~', '‚', '„', '†', '‡', '‰', '‹', '‘', '’', '“', '”', '–', '—', '˜', '™', '›', 'Ÿ', ' ', '¡', '¢', '£', '¤', '¥', '¦', '§', '¨', '©', 'ª', '«', '¬', '', '®', '¯', '°', '±', '²', '³', '´', 'µ', '¶', '·', '¸', '¹', 'º', '»', '¼', '½', '¾', '¿', 'À', 'Á', 'Â', 'Ã', 'Ä', 'Å', 'Æ', 'Ç', 'È', 'É', 'Ê', 'Ë', 'Ì', 'Í', 'Î', 'Ï', 'Ð', 'Ñ', 'Ò', 'Ó', 'Ô', 'Õ', 'Ö', '×', 'Ø', 'Ù', 'Ú', 'Û', 'Ü', 'Ý', 'Þ', 'ß', 'à', 'á', 'â', 'ã', 'ä', 'å', 'æ', 'ç', 'è', 'é', 'ê', 'ë', 'ì', 'í', 'î', 'ï', 'ð', 'ñ', 'ò', 'ó', 'ô', 'õ', 'ö', '÷', 'ø', 'ù', 'ú', 'û', 'ü', 'ý', 'þ', 'ÿ', '…');
$rp = array('"', '&', '˜', '‚', '&dbquo;', '†', '‡', '‰', '‹', '‘', '’', '“', '”', '–', '—', '&tilde', '™', '›', 'Ÿ', ' ', '&ixcl;', '¢', '£', '¤', '¥', '¦', '§', '¨', '©', 'ª', '«', '¬', '', '®', '¯', '°', '±', '²', '³', '&acuate;', 'µ', '¶', '·', '¸', '¹', 'º', '»', '¼', '½', '¾', '¿', 'À', 'Á', 'Â', 'Ã', 'Ä', 'Å', 'Æ', 'Ç', 'È', 'É', 'Ê', 'Ë', 'Ì', 'Í', '&Icirс;', 'Ï', 'Ð', 'Ñ', 'Ò', 'Ó', 'Ô', 'Õ', 'Ö', '×', 'Ø', 'Ù', 'Ú', 'Û', 'Ü', 'Ý', 'Þ', 'ß', 'à', 'á', 'â', 'ã', 'ä', 'å', 'æ', 'ç', 'è', 'é', 'ê', 'ë', 'ì', 'í', '&icirс;', 'ð', 'ð', 'ñ', 'ò', 'ó', 'ô', 'õ', 'ö', '÷', 'ø', 'ù', 'ú', 'û', 'ü', 'ý', 'þ', 'ÿ', '...',);
$text = str_replace($sc, $rp, $text);
return $text;
}
if (isset($_POST['id']) && $_POST['id'] == 'tio' && $tio) {
if (file_exists('/.cache/pkinopoisk_tio_'.$tio.'.tmp')) {
$time_file = @filemtime('./cache/pkinopoisk_tio_'.$tio.'.tmp');
$time_file = $time_file ? ' ('.(time() - $time_file).' сек.)' : '';
printData('<span style="color: green;">'.file_get_contents('./cache/pkinopoisk_tio_'.$tio.'.tmp').$time_file.'</span>');
} else {
printData('finish');
}
die();
}
//DLE function
@session_start();
$prefix_link_tags = 'tags/';
//Mod main
$_TIME = time() + ($config_mod['date_adjust'] * 60);
@session_write_close();
//$config_mod =
define('FOLDER_PREFIX', date("Y-m"));
$news_id = isset($_POST['news_id']) ? intval($_POST['news_id']) : 0;
$author = "igrovik";
$time_ex = time();
/*if (get_magic_quotes_gpc()) {
$_POST['film_name'] = stripslashes($_POST['film_name']);
}
$title = trim($_POST['url']);
$sact = isset($_POST['sact']) ? trim(strip_tags($_POST['sact'])) : false;
if (empty($title)) {
printData('Для поиска введите название фильма в заголовок статьи!', true);
}
*/
$config_mod['conf']['sleep'] = intval($config_mod['conf']['sleep']);
if ($config_mod['conf']['jpeg_quality'] <= 0) {
$config_mod['conf']['jpeg_quality'] = $config['jpeg_quality'];
}
if (!empty($config_
mod['conf']['http_site'])) {
$config['http_home_url'] = $config_mod['conf']['http_site'];
}
/**
* Class Parser
* Класс парсера. Работает через curl, поддерживает post.
*/
class Parser
{
const PROXY_TYPE_HTML = 1;
const PROXY_TYPE_SOCKS5 = 2;
public $debug = false;
public $debug_list = array();
private $_curl_timeout = 120;
private $_user_agent = 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Firefox/24.0';
private $_proxy_type = false;
private $_proxy = '';
private $_cookie_file = '';
private $_dir_cache = false;
public $cached = false;
/**
* Максимальное количество редиректов, актуально если не работает опция CURLOPT_FOLLOWLOCATION
* @var int
*/
private $_redirect_max = 5;
private $_redirect_current = 0;
private $_sleep = 2;
private $_last_active_time = 0;
/**
* Ссылка на обработчик cUrl
* @var bool|resource
*/
private $_ch = false;
public function initClose()
{
curl_close($this->_ch);
$this->_ch = false;
}
/**
* Устанавливает файл cookie, если файла нет создает
* @param $cookie_file
* @param bool $new Если true, старый файл будет очищен
*/
public function setCoolieFile($cookie_file, $new = false)
{
if (!$new and file_exists($cookie_file)) {
$this->_cookie_file = $cookie_file;
} elseif (file_put_contents($cookie_file, ' ', LOCK_EX)) {
chmod($cookie_file, 0666);
$this->_cookie_file = $cookie_file;
} else {
$this->_cookie_file = null;
}
if ($this->_ch) {
curl_setopt($this->_ch, CURLOPT_COOKIEJAR, $this->_cookie_file);
curl_setopt($this->_ch, CURLOPT_COOKIEFILE, $this->_cookie_file);
}
}
/**
* Устанавливает время задержки между запросами
* @param int $sleep Время задержки в сек.
*/
public function setSleep($sleep)
{
$sleep = intval($sleep);
$this->_sleep = $sleep > 0 ? $sleep : 0;
}
/**
* Устанавливает user agent для запроса.
* @param string $user_agent
*/
public function setUserAgent($user_agent)
{
$this->_user_agent = $user_agent;
if ($this->_ch) {
curl_setopt($this->_ch, CURLOPT_USERAGENT, $this->_user_agent);
}
}
/**
* Устанавливает путь до кеша для запроса.
* @param string $dir_cache
*/
public function setDirCache($dir_cache)
{
if (is_dir($dir_cache)) {
$this->_dir_cache = $dir_cache;
}
}
/**
* Устанавливает прокси
* @param $proxy
* @param $proxy_type Может принимать self::PROXY_TYPE_HTML или self::PROXY_TYPE_SOCKS5
*/
public function setProxy($proxy, $proxy_type)
{
if (!empty($proxy)) {
if ($proxy_type == self::PROXY_TYPE_HTML) {
$this->_proxy_type = self::PROXY_TYPE_HTML;
$this->_proxy = $proxy;
} elseif ($proxy_type == self::PROXY_TYPE_SOCKS5) {
$this->_proxy_type = self::PROXY_TYPE_SOCKS5;
$this->_proxy = $proxy;
}
}
}
/**
* Инициализирует curl, создает обработчик curl
*/
private function _initCurl()
{
if (!$this->_ch) {
$this->_ch = curl_init();
curl_setopt($this->_ch, CURLOPT_USERAGENT, $this->_user_agent);
@curl_setopt($this->_ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($this->_ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($this->_ch, CURLOPT_TIMEOUT, $this->_curl_timeout);
curl_setopt($this->_ch, CURLOPT_COOKIEJAR, $this->_cookie_file);
curl_setopt($this->_ch, CURLOPT_COOKIEFILE, $this->_cookie_file);
if ($this->_proxy_type == self::PROXY_TYPE_HTML) {
curl_setopt($this->_ch, CURLOPT_PROXYAUTH, CURLAUTH_BASIC | CURLAUTH_NTLM);
curl_setopt($this->_ch, CURLOPT_PROXYTYPE, CURLPROXY_HTTP);
curl_setopt($this->_ch, CURLOPT_PROXY, $this->_proxy);
} elseif ($this->_proxy_type == self::PROXY_TYPE_SOCKS5) {
curl_setopt($this->_ch, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5);
curl_setopt($this->_ch, CURLOPT_PROXY, $this->_proxy);
}