<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[Неофициальный форум DLNA Home Media Server &mdash; Возможно ли вообще ??]]></title>
		<link>https://hms.lostcut.net/viewtopic.php?id=557</link>
		<atom:link href="https://hms.lostcut.net/extern.php?action=feed&amp;tid=557&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[Недавние сообщения в теме «Возможно ли вообще ??».]]></description>
		<lastBuildDate>Thu, 19 Jul 2018 11:00:24 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: Возможно ли вообще ??]]></title>
			<link>https://hms.lostcut.net/viewtopic.php?pid=12418#p12418</link>
			<description><![CDATA[<div class="quotebox"><cite>spell пишет:</cite><blockquote><p>curloм как&nbsp; парсите код покажите, или в личку напишите.</p></blockquote></div><br /><p>Вариант 2</p><br /><div class="codebox"><pre><code>&lt;?php

define(&#039;DEBUG&#039;, false);

$debug = array();

if (DEBUG) {
    @error_reporting(E_ALL ^ E_WARNING ^ E_NOTICE);
    @ini_set(&#039;error_reporting&#039;, E_ALL ^ E_WARNING ^ E_NOTICE);

    @ini_set(&#039;display_errors&#039;, true);
    @ini_set(&#039;html_errors&#039;, true);
} else {
    @error_reporting(E_ERROR);
    @ini_set(&#039;error_reporting&#039;, E_ERROR);

    @ini_set(&#039;display_errors&#039;, true);
    @ini_set(&#039;html_errors&#039;, false);
}

@ini_set(&#039;max_execution_time&#039;, &#039;1800&#039;);
@set_time_limit(1800);


if (get_magic_quotes_runtime()) {
    set_magic_quotes_runtime(false);
}
$d= $_POST[&#039;url&#039;];
if($d){
    $h = &#039;1&#039;;
}
$tio = isset($h) ? intval($h) : false;
$tio = floor(lcg_value() * (999 - 2) + 2);


file_get_contents(&#039;C:\/OSPanel\/domains\/kinopoisk\/config.php&#039;);
//Функция вывода на экран
function printData($json, $error = false)
{
    global $debug, $parser;

    @header(&#039;Content-Type: text/html; charset=UTF-8&#039;);

    if (!$error) {

        if (is_string($json)) {
            $json = array(&#039;text&#039; =&gt; $json);
        }

        if (DEBUG) {
            $json[&#039;debug&#039;] = $debug;

            if (isset($parser-&gt;debug_list)) {
                $json[&#039;debug_parser&#039;] = $parser-&gt;debug_list;
            }
        }

        $json = json_encode($json);

        if (DEBUG and function_exists(&#039;json_last_error&#039;) and json_last_error()) {
            $json = array(
                &#039;debug_json&#039; =&gt; json_last_error()
            );

            $json = json_encode($json);
        }

        //echo $json;

    } else {

        $json = array(&#039;text&#039; =&gt; &#039;&lt;span style=&quot;color: red;&quot;&gt;&#039;.$json.&#039;&lt;/span&gt;&#039;);
        //echo json_encode($json);
        set_file_info(&#039;delete&#039;);
        exit;

    }
}






/**
 * Введите информацию о статусе
 * @Строка param @info
 * @обратная смесь
 */
//установить информацию о файле 
function set_file_info($info)
{
    global $tio;

    if (!$tio) {
        return false;
    }

    if ($info == &#039;delete&#039;) {
        @unlink(&#039;./cache/pkinopoisk_tio_&#039;.$tio.&#039;.tmp&#039;);
    } elseif ($info) {
        if (file_exists(&#039;./cache/pkinopoisk_tio_&#039;.$tio.&#039;.tmp&#039;)) {
            $info = &#039;&lt;br /&gt;&#039;.$info;
        }
        $fh = fopen(&#039;./cache/pkinopoisk_tio_&#039;.$tio.&#039;.tmp&#039;, &#039;a+&#039;);
        fwrite($fh, $info);
        fclose($fh);
    }
}

/**
 * Преобразование кодировки в utf-8
 * @Параметр строки $ data
 * @Параметр строки $from
 * @Параметр строки $to
 * @строка возврата
 */
function convert_charset_pkp($data, $from = &#039;cp1251&#039;, $to = &#039;utf-8&#039;)
{
    if ($from == $to) {
        return $data;
    } elseif (function_exists(&#039;mb_convert_encoding&#039;)) {
        $data = mb_convert_encoding($data, $to, $from);
    } elseif (function_exists(&#039;iconv&#039;)) {
        $data = iconv($from, $to.&#039;//IGNORE&#039;, $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(&#039;&amp;#034;&#039;, &#039;&amp;#038;&#039;, &#039;&amp;#126;&#039;, &#039;&amp;#130;&#039;, &#039;&amp;#132;&#039;, &#039;&amp;#134;&#039;, &#039;&amp;#135;&#039;, &#039;&amp;#137;&#039;, &#039;&amp;#139;&#039;, &#039;&amp;#145;&#039;, &#039;&amp;#146;&#039;, &#039;&amp;#147;&#039;, &#039;&amp;#148;&#039;, &#039;&amp;#150;&#039;, &#039;&amp;#151;&#039;, &#039;&amp;#152;&#039;, &#039;&amp;#153;&#039;, &#039;&amp;#155;&#039;, &#039;&amp;#159;&#039;, &#039;&amp;#160;&#039;, &#039;&amp;#161;&#039;, &#039;&amp;#162;&#039;, &#039;&amp;#163;&#039;, &#039;&amp;#164;&#039;, &#039;&amp;#165;&#039;, &#039;&amp;#166;&#039;, &#039;&amp;#167;&#039;, &#039;&amp;#168;&#039;, &#039;&amp;#169;&#039;, &#039;&amp;#170;&#039;, &#039;&amp;#171;&#039;, &#039;&amp;#172;&#039;, &#039;&amp;#173;&#039;, &#039;&amp;#174;&#039;, &#039;&amp;#175;&#039;, &#039;&amp;#176;&#039;, &#039;&amp;#177;&#039;, &#039;&amp;#178;&#039;, &#039;&amp;#179;&#039;, &#039;&amp;#180;&#039;, &#039;&amp;#181;&#039;, &#039;&amp;#182;&#039;, &#039;&amp;#183;&#039;, &#039;&amp;#184;&#039;, &#039;&amp;#185;&#039;, &#039;&amp;#186;&#039;, &#039;&amp;#187;&#039;, &#039;&amp;#188;&#039;, &#039;&amp;#189;&#039;, &#039;&amp;#190;&#039;, &#039;&amp;#191;&#039;, &#039;&amp;#192;&#039;, &#039;&amp;#193;&#039;, &#039;&amp;#194;&#039;, &#039;&amp;#195;&#039;, &#039;&amp;#196;&#039;, &#039;&amp;#197;&#039;, &#039;&amp;#198;&#039;, &#039;&amp;#199;&#039;, &#039;&amp;#200;&#039;, &#039;&amp;#201;&#039;, &#039;&amp;#202;&#039;, &#039;&amp;#203;&#039;, &#039;&amp;#204;&#039;, &#039;&amp;#205;&#039;, &#039;&amp;#206;&#039;, &#039;&amp;#207;&#039;, &#039;&amp;#208;&#039;, &#039;&amp;#209;&#039;, &#039;&amp;#210;&#039;, &#039;&amp;#211;&#039;, &#039;&amp;#212;&#039;, &#039;&amp;#213;&#039;, &#039;&amp;#214;&#039;, &#039;&amp;#215;&#039;, &#039;&amp;#216;&#039;, &#039;&amp;#217;&#039;, &#039;&amp;#218;&#039;, &#039;&amp;#219;&#039;, &#039;&amp;#220;&#039;, &#039;&amp;#221;&#039;, &#039;&amp;#222;&#039;, &#039;&amp;#223;&#039;, &#039;&amp;#224;&#039;, &#039;&amp;#225;&#039;, &#039;&amp;#226;&#039;, &#039;&amp;#227;&#039;, &#039;&amp;#228;&#039;, &#039;&amp;#229;&#039;, &#039;&amp;#230;&#039;, &#039;&amp;#231;&#039;, &#039;&amp;#232;&#039;, &#039;&amp;#233;&#039;, &#039;&amp;#234;&#039;, &#039;&amp;#235;&#039;, &#039;&amp;#236;&#039;, &#039;&amp;#237;&#039;, &#039;&amp;#238;&#039;, &#039;&amp;#239;&#039;, &#039;&amp;#240;&#039;, &#039;&amp;#241;&#039;, &#039;&amp;#242;&#039;, &#039;&amp;#243;&#039;, &#039;&amp;#244;&#039;, &#039;&amp;#245;&#039;, &#039;&amp;#246;&#039;, &#039;&amp;#247;&#039;, &#039;&amp;#248;&#039;, &#039;&amp;#249;&#039;, &#039;&amp;#250;&#039;, &#039;&amp;#251;&#039;, &#039;&amp;#252;&#039;, &#039;&amp;#253;&#039;, &#039;&amp;#254;&#039;, &#039;&amp;#255;&#039;, &#039;&amp;#133;&#039;);

    $rp = array(&#039;&amp;quot;&#039;, &#039;&amp;amp;&#039;, &#039;&amp;tilde;&#039;, &#039;&amp;sbquo;&#039;, &#039;&amp;dbquo;&#039;, &#039;&amp;dagger;&#039;, &#039;&amp;Dagger;&#039;, &#039;&amp;permil;&#039;, &#039;&amp;lsaquo;&#039;, &#039;&amp;lsquo;&#039;, &#039;&amp;rsquo;&#039;, &#039;&amp;ldquo;&#039;, &#039;&amp;rdquo;&#039;, &#039;&amp;ndash;&#039;, &#039;&amp;mdash;&#039;, &#039;&amp;tilde&#039;, &#039;&amp;trade;&#039;, &#039;&amp;rsaquo;&#039;, &#039;&amp;Yuml;&#039;, &#039;&amp;nbsp;&#039;, &#039;&amp;ixcl;&#039;, &#039;&amp;cent;&#039;, &#039;&amp;pound;&#039;, &#039;&amp;curren;&#039;, &#039;&amp;yen;&#039;, &#039;&amp;brvbar;&#039;, &#039;&amp;sect;&#039;, &#039;&amp;uml;&#039;, &#039;&amp;copy;&#039;, &#039;&amp;ordf;&#039;, &#039;&amp;laquo;&#039;, &#039;&amp;not;&#039;, &#039;&amp;shy;&#039;, &#039;&amp;reg;&#039;, &#039;&amp;macr;&#039;, &#039;&amp;deg;&#039;, &#039;&amp;plusmn;&#039;, &#039;&amp;sup2;&#039;, &#039;&amp;sup3;&#039;, &#039;&amp;acuate;&#039;, &#039;&amp;micro;&#039;, &#039;&amp;para;&#039;, &#039;&amp;middot;&#039;, &#039;&amp;cedil;&#039;, &#039;&amp;sup1;&#039;, &#039;&amp;ordm;&#039;, &#039;&amp;raquo;&#039;, &#039;&amp;frac14;&#039;, &#039;&amp;frac12;&#039;, &#039;&amp;frac34;&#039;, &#039;&amp;iquest;&#039;, &#039;&amp;Agrave;&#039;, &#039;&amp;Aacute;&#039;, &#039;&amp;Acirc;&#039;, &#039;&amp;Atilde;&#039;, &#039;&amp;Auml;&#039;, &#039;&amp;Aring;&#039;, &#039;&amp;AElig;&#039;, &#039;&amp;Ccedil;&#039;, &#039;&amp;Egrave;&#039;, &#039;&amp;Eacute;&#039;, &#039;&amp;Ecirc;&#039;, &#039;&amp;Euml;&#039;, &#039;&amp;Igrave;&#039;, &#039;&amp;Iacute;&#039;, &#039;&amp;Icirс;&#039;, &#039;&amp;Iuml;&#039;, &#039;&amp;ETH;&#039;, &#039;&amp;Ntilde;&#039;, &#039;&amp;Ograve;&#039;, &#039;&amp;Oacute;&#039;, &#039;&amp;Ocirc;&#039;, &#039;&amp;Otilde;&#039;, &#039;&amp;Ouml;&#039;, &#039;&amp;times;&#039;, &#039;&amp;Oslash;&#039;, &#039;&amp;Ugrave;&#039;, &#039;&amp;Uacute;&#039;, &#039;&amp;Ucirc;&#039;, &#039;&amp;Uuml;&#039;, &#039;&amp;Yacute;&#039;, &#039;&amp;THORN;&#039;, &#039;&amp;szlig;&#039;, &#039;&amp;agrave;&#039;, &#039;&amp;aacute;&#039;, &#039;&amp;acirc;&#039;, &#039;&amp;atilde;&#039;, &#039;&amp;auml;&#039;, &#039;&amp;aring;&#039;, &#039;&amp;aelig;&#039;, &#039;&amp;ccedil;&#039;, &#039;&amp;egrave;&#039;, &#039;&amp;eacute;&#039;, &#039;&amp;ecirc;&#039;, &#039;&amp;euml;&#039;, &#039;&amp;igrave;&#039;, &#039;&amp;iacute;&#039;, &#039;&amp;icirс;&#039;, &#039;&amp;eth;&#039;, &#039;&amp;eth;&#039;, &#039;&amp;ntilde;&#039;, &#039;&amp;ograve;&#039;, &#039;&amp;oacute;&#039;, &#039;&amp;ocirc;&#039;, &#039;&amp;otilde;&#039;, &#039;&amp;ouml;&#039;, &#039;&amp;divide;&#039;, &#039;&amp;oslash;&#039;, &#039;&amp;ugrave;&#039;, &#039;&amp;uacute;&#039;, &#039;&amp;ucirc;&#039;, &#039;&amp;uuml;&#039;, &#039;&amp;yacute;&#039;, &#039;&amp;thorn;&#039;, &#039;&amp;yuml;&#039;, &#039;...&#039;,);

    $text = str_replace($sc, $rp, $text);

    return $text;
}


if (isset($_POST[&#039;id&#039;]) &amp;&amp; $_POST[&#039;id&#039;] == &#039;tio&#039; &amp;&amp; $tio) {
    if (file_exists(&#039;/.cache/pkinopoisk_tio_&#039;.$tio.&#039;.tmp&#039;)) {
        $time_file = @filemtime(&#039;./cache/pkinopoisk_tio_&#039;.$tio.&#039;.tmp&#039;);
        $time_file = $time_file ? &#039; (&#039;.(time() - $time_file).&#039; сек.)&#039; : &#039;&#039;;
        printData(&#039;&lt;span style=&quot;color: green;&quot;&gt;&#039;.file_get_contents(&#039;./cache/pkinopoisk_tio_&#039;.$tio.&#039;.tmp&#039;).$time_file.&#039;&lt;/span&gt;&#039;);
    } else {
        printData(&#039;finish&#039;);
    }
    die();
}

//DLE function
@session_start();

$prefix_link_tags = &#039;tags/&#039;;






//Mod main

$_TIME = time() + ($config_mod[&#039;date_adjust&#039;] * 60);

@session_write_close();
//$config_mod = 

define(&#039;FOLDER_PREFIX&#039;, date(&quot;Y-m&quot;));

$news_id = isset($_POST[&#039;news_id&#039;]) ? intval($_POST[&#039;news_id&#039;]) : 0;
$author  = &quot;igrovik&quot;;
$time_ex = time();

/*if (get_magic_quotes_gpc()) {
    $_POST[&#039;film_name&#039;] = stripslashes($_POST[&#039;film_name&#039;]);
}

$title = trim($_POST[&#039;url&#039;]);
$sact  = isset($_POST[&#039;sact&#039;]) ? trim(strip_tags($_POST[&#039;sact&#039;])) : false;

if (empty($title)) {
    printData(&#039;Для поиска введите название фильма в заголовок статьи!&#039;, true);
}
*/
$config_mod[&#039;conf&#039;][&#039;sleep&#039;] = intval($config_mod[&#039;conf&#039;][&#039;sleep&#039;]);

if ($config_mod[&#039;conf&#039;][&#039;jpeg_quality&#039;] &lt;= 0) {
    $config_mod[&#039;conf&#039;][&#039;jpeg_quality&#039;] = $config[&#039;jpeg_quality&#039;];
}

if (!empty($config_mod[&#039;conf&#039;][&#039;http_site&#039;])) {
    $config[&#039;http_home_url&#039;] = $config_mod[&#039;conf&#039;][&#039;http_site&#039;];
}


/**
 * 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 = &#039;Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Firefox/24.0&#039;;
    private $_proxy_type = false;
    private $_proxy = &#039;&#039;;
    private $_cookie_file = &#039;&#039;;

    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-&gt;_ch);
        $this-&gt;_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-&gt;_cookie_file = $cookie_file;

        } elseif (file_put_contents($cookie_file, &#039; &#039;, LOCK_EX)) {

            chmod($cookie_file, 0666);
            $this-&gt;_cookie_file = $cookie_file;

        } else {

            $this-&gt;_cookie_file = null;

        }

        if ($this-&gt;_ch) {
            curl_setopt($this-&gt;_ch, CURLOPT_COOKIEJAR, $this-&gt;_cookie_file);
            curl_setopt($this-&gt;_ch, CURLOPT_COOKIEFILE, $this-&gt;_cookie_file);
        }

    }

    /**
     * Устанавливает время задержки между запросами
     * @param int $sleep Время задержки в сек.
     */
    public function setSleep($sleep)
    {
        $sleep        = intval($sleep);
        $this-&gt;_sleep = $sleep &gt; 0 ? $sleep : 0;
    }

    /**
     * Устанавливает user agent для запроса.
     * @param string $user_agent
     */
    public function setUserAgent($user_agent)
    {
        $this-&gt;_user_agent = $user_agent;

        if ($this-&gt;_ch) {
            curl_setopt($this-&gt;_ch, CURLOPT_USERAGENT, $this-&gt;_user_agent);
        }
    }

    /**
     * Устанавливает путь до кеша для запроса.
     * @param string $dir_cache
     */
    public function setDirCache($dir_cache)
    {
        if (is_dir($dir_cache)) {
            $this-&gt;_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-&gt;_proxy_type = self::PROXY_TYPE_HTML;
                $this-&gt;_proxy      = $proxy;

            } elseif ($proxy_type == self::PROXY_TYPE_SOCKS5) {

                $this-&gt;_proxy_type = self::PROXY_TYPE_SOCKS5;
                $this-&gt;_proxy      = $proxy;
            }
        }
    }

    /**
     * Инициализирует curl, создает обработчик curl
     */
    private function _initCurl()
    {
        if (!$this-&gt;_ch) {

            $this-&gt;_ch = curl_init();

            curl_setopt($this-&gt;_ch, CURLOPT_USERAGENT, $this-&gt;_user_agent);
            @curl_setopt($this-&gt;_ch, CURLOPT_FOLLOWLOCATION, 1);
            curl_setopt($this-&gt;_ch, CURLOPT_RETURNTRANSFER, 1);
            curl_setopt($this-&gt;_ch, CURLOPT_TIMEOUT, $this-&gt;_curl_timeout);
            curl_setopt($this-&gt;_ch, CURLOPT_COOKIEJAR, $this-&gt;_cookie_file);
            curl_setopt($this-&gt;_ch, CURLOPT_COOKIEFILE, $this-&gt;_cookie_file);

            if ($this-&gt;_proxy_type == self::PROXY_TYPE_HTML) {
                curl_setopt($this-&gt;_ch, CURLOPT_PROXYAUTH, CURLAUTH_BASIC | CURLAUTH_NTLM);
                curl_setopt($this-&gt;_ch, CURLOPT_PROXYTYPE, CURLPROXY_HTTP);
                curl_setopt($this-&gt;_ch, CURLOPT_PROXY, $this-&gt;_proxy);
            } elseif ($this-&gt;_proxy_type == self::PROXY_TYPE_SOCKS5) {
                curl_setopt($this-&gt;_ch, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5);
                curl_setopt($this-&gt;_ch, CURLOPT_PROXY, $this-&gt;_proxy);
            }

            $curl_version = curl_version();
            if (preg_match(&#039;#^([0-9]+)\.([0-9]+)#is&#039;, $curl_version[&#039;version&#039;], $match) and $match[1] &gt;= 7 and $match[2] &gt;= 10) {
                if (function_exists(&#039;gzdecode&#039;)) {
                    curl_setopt($this-&gt;_ch, CURLOPT_ENCODING, &#039;gzip, deflate&#039;);
                } else {
                    curl_setopt($this-&gt;_ch, CURLOPT_ENCODING, &#039;&#039;);
                }
            }

            curl_setopt($this-&gt;_ch, CURLOPT_HTTPHEADER, array(
                &#039;Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8&#039;,
                &#039;Accept-Language: ru-RU,ru;q=0.8,en-US;q=0.5,en;q=0.3&#039;,
                &#039;Cache-Control:    max-age=0&#039;,
                &#039;DNT: 0&#039;,
                &#039;Connection: keep-alive&#039;,
                &#039;Proxy-Connection:&#039;
            ));

            curl_setopt($this-&gt;_ch, CURLOPT_HEADER, 1);

        }
    }

    /**
     * Загружает страницу. Публичный
     * @param $url
     * @param bool $refer
     * @param bool $post
     * @return bool|mixed|string
     */
    public function loadPage($url, $refer = false, $post = false)
    {
        if (($page = $this-&gt;_getCache($url.http_build_query($post))) and !$this-&gt;debug) {
            return $page;
        }

        $this-&gt;_redirect_current = 0;

        $this-&gt;_initCurl();

        if ($refer) {
            curl_setopt($this-&gt;_ch, CURLOPT_REFERER, $refer);
        } else {
            curl_setopt($this-&gt;_ch, CURLOPT_REFERER, null);
        }

        if ($post) {
            curl_setopt($this-&gt;_ch, CURLOPT_POST, true);
            curl_setopt($this-&gt;_ch, CURLOPT_POSTFIELDS, $post);
        } else {
            curl_setopt($this-&gt;_ch, CURLOPT_POST, false);
            curl_setopt($this-&gt;_ch, CURLOPT_HTTPGET, true);
        }

        $page = $this-&gt;_load($url);

        $this-&gt;_setCache($url.http_build_query($post), $page);

        return $page;
    }

    private function _load($url)
    {
        if ($this-&gt;_redirect_current &gt;= $this-&gt;_redirect_max) {
            return false;
        }

        if ($this-&gt;_sleep &gt; 0) {
            if (($this-&gt;_last_active_time + $this-&gt;_sleep) &gt; time()) {
                sleep($this-&gt;_sleep);
            }
            $this-&gt;_last_active_time = time();
        }

        if ($this-&gt;debug) {
            curl_setopt($this-&gt;_ch, CURLINFO_HEADER_OUT, true);
        }

        curl_setopt($this-&gt;_ch, CURLOPT_URL, $url);

        $page = curl_exec($this-&gt;_ch);

        $curl_info = curl_getinfo($this-&gt;_ch);

        if ($this-&gt;debug) {
            $this-&gt;debug_list[] = array(
                &#039;url&#039;            =&gt; $url,
                &#039;request_header&#039; =&gt; $curl_info[&#039;request_header&#039;],
                &#039;header&#039;         =&gt; substr($page, 0, $curl_info[&#039;header_size&#039;]),
                &#039;body&#039;           =&gt; convert_charset_pkp(substr($page, $curl_info[&#039;header_size&#039;]), $from = &#039;cp1251&#039;, $to = &#039;utf-8&#039;),
                &#039;curl_errno&#039;     =&gt; curl_errno($this-&gt;_ch),
                &#039;curl_error&#039;     =&gt; curl_error($this-&gt;_ch)
            );
        }

        if ($curl_info[&#039;http_code&#039;] == 301 or $curl_info[&#039;http_code&#039;] == 302) {

            $header = substr($page, 0, $curl_info[&#039;header_size&#039;]);

            if (preg_match(&#039;/Location:(.*?)(\n|$)/is&#039;, $header, $matches) and ($url = parse_url(trim($matches[1])))) {
                $url[&#039;scheme&#039;] = $url[&#039;scheme&#039;] ? $url[&#039;scheme&#039;] : &#039;http&#039;;
                $url[&#039;host&#039;]   = $url[&#039;host&#039;] ? $url[&#039;host&#039;] : &#039;megapesni.me&#039;;
                $url[&#039;path&#039;]   = $url[&#039;path&#039;] ? $url[&#039;path&#039;] : &#039;&#039;;
                $url[&#039;query&#039;]  = $url[&#039;query&#039;] ? &#039;?&#039;.$url[&#039;query&#039;] : &#039;&#039;;

                $url = $url[&#039;scheme&#039;].&#039;://&#039;.$url[&#039;host&#039;].$url[&#039;path&#039;].$url[&#039;query&#039;];

                $this-&gt;_redirect_current++;

                return $this-&gt;_load($url);
            } else {
                return false;
            }
        }

        $page = substr($page, $curl_info[&#039;header_size&#039;]);

        return $page;

    }

    /**
     * Записывает данные в кеш
     * @param $url
     * @param $page
     * @return bool|int
     */
    private function _setCache($url, $page)
    {
        if ($this-&gt;cached and $this-&gt;_dir_cache) {
            return file_put_contents($this-&gt;_dir_cache.&#039;/parser_cache_page_&#039;.md5($url).&#039;.tmp&#039;, $page, LOCK_EX);
        }

        return false;
    }

    /**
     * Берет данные из кеша
     * @param $url
     * @return bool|string
     */
    private function _getCache($url)
    {
        if ($this-&gt;cached and $this-&gt;_dir_cache) {
            $file = $this-&gt;_dir_cache.&#039;/parser_cache_page_&#039;.md5($url).&#039;.tmp&#039;;

            if (file_exists($file)) {
                return file_get_contents($file);
            }
        }

        return false;
    }
}

$parser        = new Parser();
$parser-&gt;debug = DEBUG;
$parser-&gt;setDirCache(&#039;./cache&#039;);
$parser-&gt;cached = true;

$proxy_type = 0;
if ($config_mod[&#039;conf&#039;][&#039;proxy_type&#039;] == 1) {
    $proxy_type = Parser::PROXY_TYPE_HTML;
} elseif ($config_mod[&#039;conf&#039;][&#039;proxy_type&#039;] == 2) {
    $proxy_type = Parser::PROXY_TYPE_SOCKS5;
}
$parser-&gt;setProxy($config_mod[&#039;conf&#039;][&#039;proxy&#039;], $proxy_type);

if (isset($_SERVER[&#039;HTTP_USER_AGENT&#039;]) &amp;&amp; strlen($_SERVER[&#039;HTTP_USER_AGENT&#039;]) &gt; 25) {
    $parser-&gt;setUserAgent($_SERVER[&#039;HTTP_USER_AGENT&#039;]);
}

define(&#039;MOD_COOKIE_FILE&#039;, &#039;./cache/cookie_www.kinopoisk.ru.tmp&#039;);
define( &#039;FOLDER_PREFIX&#039;, date( &quot;Y-m&quot; ) );
/**
 * Удаляем файл cookie и создаем пустой новый файл
 */
function clear_cookie_file()
{
    @unlink(MOD_COOKIE_FILE);
    $fh = fopen(MOD_COOKIE_FILE, &#039;w&#039;);
    fwrite($fh, &#039;&#039;);
    fclose($fh);
    chmod(MOD_COOKIE_FILE, 0666);
}

if (!is_file(MOD_COOKIE_FILE) or filemtime(MOD_COOKIE_FILE) &lt; (time() - 43200)) {
    clear_cookie_file();
}

$parser-&gt;setCoolieFile(MOD_COOKIE_FILE);


    set_file_info(&#039;delete&#039;);
    

    if (!($refer = $author)) {
        $refer = &#039;http://megapesni.me/&#039;;
    }
$url_link = &#039;http://megapesni.me/popsa/139692-vremja-i-steklo-ebojj.html&#039;;
$pars_oboi = $parser-&gt;loadPage($url_link);    
echo $pars_oboi;

?&gt;</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (na-socke.tk)]]></author>
			<pubDate>Thu, 19 Jul 2018 11:00:24 +0000</pubDate>
			<guid>https://hms.lostcut.net/viewtopic.php?pid=12418#p12418</guid>
		</item>
		<item>
			<title><![CDATA[Re: Возможно ли вообще ??]]></title>
			<link>https://hms.lostcut.net/viewtopic.php?pid=12417#p12417</link>
			<description><![CDATA[<div class="quotebox"><cite>spell пишет:</cite><blockquote><p>curloм как&nbsp; парсите код покажите, или в личку напишите.</p></blockquote></div><br /><p>Вариант 1</p><br /><div class="codebox"><pre><code>function get_urls( $url,  $javascript_loop = 0, $timeout = 80)
{
    //$url = str_replace( &quot;&amp;amp;&quot;, &quot;&amp;&quot;, urldecode(trim($url)) );
  
  $cookie = tempnam (&quot;/tmp&quot;, &quot;CURLCOOKIE&quot;);
    
    $headers = &quot;Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8\r\n&quot;.
    &quot;Accept-Encoding: gzip, deflate\r\n&quot;.
    &quot;Accept-Language: ru-RU,ru;q=0.9,en-US;q=0.8,en;q=0.7\r\n&quot;.
    &quot;Cache-Control: max-age=0\r\n&quot;.
    &quot;Host: megapesni.me\r\n&quot;.
    &quot;Proxy-Connection: keep-alive\r\n&quot;.
    &quot;Upgrade-Insecure-Requests: 1\r\n&quot;
           ;
    
$ch = curl_init();
    curl_setopt($ch, CURLOPT_HEADER, 0);
    curl_setopt($ch, CURLOPT_HTTPHEADER, array($headers));
    curl_setopt( $ch, CURLOPT_USERAGENT, &quot;Mozilla/5.0 (Windows; U; Windows NT 5.1; rv:1.7.3) Gecko/20041001 Firefox/0.10.1&quot; );
    curl_setopt( $ch, CURLOPT_URL, $url );
    curl_setopt( $ch, CURLOPT_COOKIEJAR, $cookie );
    curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, true );
    curl_setopt( $ch, CURLOPT_ENCODING, &quot;&quot; );
    curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
    curl_setopt( $ch, CURLOPT_AUTOREFERER, true );
  curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false );    # required for https urls
    curl_setopt( $ch, CURLOPT_CONNECTTIMEOUT, $timeout );
    curl_setopt( $ch, CURLOPT_TIMEOUT, $timeout );
    curl_setopt( $ch, CURLOPT_MAXREDIRS, 10 );
    $content = curl_exec( $ch );
    return ($content);
    curl_close ( $ch );

    
    
    
}</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (na-socke.tk)]]></author>
			<pubDate>Thu, 19 Jul 2018 10:59:00 +0000</pubDate>
			<guid>https://hms.lostcut.net/viewtopic.php?pid=12417#p12417</guid>
		</item>
		<item>
			<title><![CDATA[Re: Возможно ли вообще ??]]></title>
			<link>https://hms.lostcut.net/viewtopic.php?pid=12416#p12416</link>
			<description><![CDATA[<p>curloм как&nbsp; парсите код покажите, или в личку напишите.</p>]]></description>
			<author><![CDATA[null@example.com (Spell)]]></author>
			<pubDate>Thu, 19 Jul 2018 10:55:41 +0000</pubDate>
			<guid>https://hms.lostcut.net/viewtopic.php?pid=12416#p12416</guid>
		</item>
		<item>
			<title><![CDATA[Возможно ли вообще ??]]></title>
			<link>https://hms.lostcut.net/viewtopic.php?pid=12415#p12415</link>
			<description><![CDATA[<p>Привет всем есть сайт megapesni.me (Не реклама) .<br />При парсинге на локалке все работает как через file_get_contents так и через curl.<br />Но как только переношу на хостинг сразу выдает ошибку <br /></p><div class="codebox"><pre><code>Please enable cookies.
Error 1007 Ray ID: 43cc395723888e13 • 2018-07-19 09:39:59 UTC
Access denied
What happened?
The owner of this website (megapesni.me) has banned your IP address (x.x.x.x).

Cloudflare Ray ID: 43cc395723888e13 • Your IP: x.x.x.x • Performance &amp; security by Cloudflare</code></pre></div><p>Может кто знает как это обойти, или предложит готовое решение. Заранее спасибо всем кто откликнется.</p>]]></description>
			<author><![CDATA[null@example.com (na-socke.tk)]]></author>
			<pubDate>Thu, 19 Jul 2018 10:19:00 +0000</pubDate>
			<guid>https://hms.lostcut.net/viewtopic.php?pid=12415#p12415</guid>
		</item>
	</channel>
</rss>
