• Как правильно составить регулярное выражение?

    @saniii Автор вопроса
    irishmann, c помощью зщые запроса получаю страницу стороннего сайта, я не запоняю, я просто занимаюсь парсингом.
  • Как правильно составить регулярное выражение?

    @saniii Автор вопроса
    Прошу прощение может я не правильно выразился или вы не правильно меня поняли, нужно понять слово вместо звездочек(*****) идет с приставкой _adv или нет.
    <b><div class="project_line line project780269" data-type="*****"></b>
  • Как правильно настроить сеть в proxmox ve со статичным ip?

    @saniii Автор вопроса
    А как нибуть по типу VirtualBox c пробросом не предусмотрено в proxmox?

    Если хотите что бы пинги пошли, сделайте маскарад

    маскарад что это?

    или не давайте физическому интерфейсу адрес, а сразу переводите его в бридж на виртуальный интерфейс vmbr0

    а как в таком случаи быть при наличии 2 и более виртуальных интерфейсов? каждому присваивать один реальный ip?
  • Как найти пакет proxmox-ve в репощзитарии debian?

    @saniii Автор вопроса
    да вы правы не подгрузил репозитарии вот логи:
    spoiler
    apt install proxmox-ve
    Чтение списков пакетов… Готово
    Построение дерева зависимостей
    Чтение информации о состоянии… Готово
    E: Не удалось найти пакет proxmox-ve
    root@Server:/home/mainuser# nano /etc/apt/sources.list.d/pve-install-repo.list
    root@Server:/home/mainuser# apt install proxmox-ve
    Чтение списков пакетов… Готово
    Построение дерева зависимостей
    Чтение информации о состоянии… Готово
    E: Не удалось найти пакет proxmox-ve
    root@Server:/home/mainuser# apt update
    Пол:1 http://security.debian.org/debian-security stretch/updates InRelease [94,3 kB]
    Игн:2 http://mirror.yandex.ru/debian stretch InRelease
    Сущ:3 http://mirror.yandex.ru/debian stretch-updates InRelease
    Сущ:4 http://mirror.yandex.ru/debian stretch Release
    Сущ:5 http://download.proxmox.com/debian/pve stretch InRelease
    Получено 94,3 kБ за 0с (97,7 kБ/c)
    Чтение списков пакетов… Готово
    Построение дерева зависимостей
    Чтение информации о состоянии… Готово
    Все пакеты имеют последние версии.
    N: Пропускается получение настроенного файла «pve-no-subscription/binary-i386/Packages», так как репозиторий «http://download.proxmox.com/debian/pve stretch InRelease» не поддерживает архитектуру «i386»


    пришлось прибегнуть к
    NOTE: If you have enabled other another arch (typically, i386 to run some older software) and apt complains about not being able to find /binary-i386: "Unable to find expected entry 'pve/binary-i386/Packages'" you need to remove other arch or use instead the row:
    
    deb [arch=amd64] http://download.proxmox.com/debian/pve stretch pve-no-subscription
  • Как дать пользователю права на перезагрузку Debian?

    @saniii Автор вопроса
    ky0, как же тогда правильно указать, чтобы можно было тольк ребутнуть?
  • Как дать пользователю права на перезагрузку Debian?

    @saniii Автор вопроса
    ky0, для выключения же используются poweroff, разьве я не прав?
  • Как присвоить глобальную переменную в классе PHP?

    @saniii Автор вопроса
    OKyJIucT, спасибо, это конечно такие костыли, но работают. Я так понимаю это в каждом наследуемом классе нужно проделать?)
  • Как присвоить глобальную переменную в классе PHP?

    @saniii Автор вопроса
    что то проблемка, если использовать функции не работает ваш пример:
    класс cURL
    spoiler
    <?php
    
    /**
    * 
    *    Файл-обертка для библиотеки cURL
    *
    */
    
    class Curl 
    {
    
      const FOLLOWLOCATION = true;
      const RETURNTRANSFER = true;
      const AUTOREFERER = true;
      const TIMEOUT = 30;
      const CONNECT_TIME = 30;
    
      public $user_agent = null;
      public $proxy;
    
      private $ch = null;
      private $url = null;	
      private $httpheaders = [];
      private $postparams = null;
      private $proxy_type = null;
      private $cookies = null;
    
      
    public function __construct($proxy) 
      {
        $this->ch = curl_init();
        $this->proxy = $proxy;
      }
        
      //	Функция POST/GET - запросов
      public function post($url, $postparams = []) 
      {
        $this->url = $url;	
        if (isset($postparams)) {	
          $this->postparams = $postparams;
        }		
        return $this->exec();
      }
      
      //	Заголовок запроса (!)
      public function addHttpheaders($headers)
      {
        foreach ($headers as $name => $value) {
          if ($name == 'POST') {
            $this->httpheaders[$name] = $name . ' ' . $value;
          } else {
            $this->httpheaders[$name] = $name . ': ' . $value;
          }
        }
      }
    
      //	Присваемваем USER-AGENT
      public function setUserAgent($user_agent = null)
      {
        $this->user_agent = $user_agent;
      }
    
      //	Подключение прокси (HTTPS/SOCKS5)
      public function setProxy($proxy_ip, $proxy_type = '')
      {
        $this->proxy = $proxy_ip;
        $this->proxy_type = $proxy_type;
      }
    
      //	Временное имя дsя cookie файла
      private function nameCookies($name = null)
      {
        for ($i=0; $i<10; ++$i)
                $name .= chr(rand(97, 122));
            return $name . '.temp';
      }
    
      //	Создание cookie файла
      public function setFileCookies()
      {
        $this->cookies = $this->nameCookies();
        file_put_contents($this->cookies, "");
      }
    
      //	Удаление cookie файла
      public function clearCookies()
      {
        unlink($this->cookies);
      }
    
      private function exec()
      {
        curl_setopt($this->ch, CURLOPT_URL, $this->url);
        curl_setopt($this->ch, CURLOPT_FOLLOWLOCATION , self::FOLLOWLOCATION);
        curl_setopt($this->ch, CURLOPT_AUTOREFERER, self::AUTOREFERER);
        curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, self::RETURNTRANSFER);	
        curl_setopt($this->ch, CURLOPT_HEADER, true);
        
        if ($this->postparams)
          curl_setopt($this->ch, CURLOPT_POSTFIELDS, $this->postparams);
        
        if (count($this->httpheaders))
          curl_setopt($this->ch, CURLOPT_HTTPHEADER, $this->httpheaders);
    
        if ($this->proxy)
          curl_setopt($this->ch, CURLOPT_PROXY, $this->setProxyIp());
          
        if ($this->proxy_type == 'socks5')
          curl_setopt($this->ch, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5);
    
        curl_setopt($this->ch, CURLOPT_TIMEOUT, self::TIMEOUT);
        curl_setopt($this->ch, CURLOPT_CONNECTTIMEOUT, self::CONNECT_TIME);
        curl_setopt($this->ch, CURLOPT_COOKIEJAR, $this->cookies);	//	Файл для записи cookies
       		curl_setopt($this->ch, CURLOPT_COOKIEFILE, $this->cookies);	//	Файл для чтения cookies
        $response = curl_exec($this->ch);
        $response = substr($response, curl_getinfo($this->ch, CURLINFO_HEADER_SIZE));
            
        $this->postparams = null;
        
        return $response;
      }
      
      public function __destruct()
      {
        curl_close($this->ch);
      }
    это еще 1 класс Parser
    spoiler
    <?php
    class Parser
    {
        
        private $curl;
        private $anticaptcha;
    
        public function __construct ()
        {
            $this->curl = new Curl();
        }   
    
        //    Изменение приватности на сайте www.vk.com
        private function setPrivate()
        {
            //тут еще код не суть важно
            $this->curl->post('***');//здесь уже прокси не подставляется
        }
    
        public function test()
        {
           return $this->curl->post('http://httpbin.org/ip');//здесь уже прокси не подставляется
        }
    }


    файл запуска
    <?php
    spl_autoload_register(function ($class) {
            require_once $class . '.php';
        });
    $curl = new Curl();
    $pr= new Parser();
    $curl->setProxy('185.82.212.95:8080');
    $pr->test();
  • Как присвоить глобальную переменную в классе PHP?

    @saniii Автор вопроса
    И метод apiCaptcha должен быть публичным, иначе вы не сможете его вызвать извне класса AntiCaptcha

    OKyJIucT, спасибо а его и не надо вызывать дальше класса, он необходим в самом классе AntiCaptcha.
  • Как присвоить глобальную переменную в классе PHP?

    @saniii Автор вопроса
    спасибо буду копать, и делать)
  • Как присвоить глобальную переменную в классе PHP?

    @saniii Автор вопроса
    есть вот такой наследник(кусок кода)
    class AntiCaptcha extends Curl
    {
        
        const ANTI_CAPTCHA_API = 'https://api.anti-captcha.com/';
    
        //	API для работы с www.anti-captcha.com
    	private function apiCaptcha($method = null, $postparams = null)
    	{
    	    Curl::addHttpheaders([
    	    	"User-Agent"      => $this->user_agent, 
    	        "Content-Type"    => "application/json; charset=utf-8",
    	        "Accept"          =>"application/json"
    	    	]);
    	    $content = $this->post(self::ANTI_CAPTCHA_API . $method, json_encode($postparams));
    	    $response = json_decode($content, true);
    	    return $response;
    	}
  • Как присвоить глобальную переменную в классе PHP?

    @saniii Автор вопроса
    сейчас попрубую. я так понимаю на наследников это не будет распространяться?
  • Как присвоить глобальную переменную в классе PHP?

    @saniii Автор вопроса
    что то не то по-моему
    <?php
    
    /**
    * 
    *    Файл-обертка для библиотеки cURL
    *
    */
    
    class Curl 
    {
    
      const FOLLOWLOCATION = true;
      const RETURNTRANSFER = true;
      const AUTOREFERER = true;
      const TIMEOUT = 30;
      const CONNECT_TIME = 30;
    
      public $user_agent = null;
      public $proxy;
    
      private $ch = null;
      private $url = null;	
      private $httpheaders = [];
      private $postparams = null;
      private $proxy_type = null;
      private $cookies = null;
    
      
    public function __construct($proxy) 
      {
        $this->ch = curl_init();
        $this->proxy = $proxy;
      }
        
      //	Функция POST/GET - запросов
      public function post($url, $postparams = []) 
      {
        $this->url = $url;	
        if (isset($postparams)) {	
          $this->postparams = $postparams;
        }		
        return $this->exec();
      }
      
      //	Заголовок запроса (!)
      public function addHttpheaders($headers)
      {
        foreach ($headers as $name => $value) {
          if ($name == 'POST') {
            $this->httpheaders[$name] = $name . ' ' . $value;
          } else {
            $this->httpheaders[$name] = $name . ': ' . $value;
          }
        }
      }
    
      //	Присваемваем USER-AGENT
      public function setUserAgent($user_agent = null)
      {
        $this->user_agent = $user_agent;
      }
    
      //	Подключение прокси (HTTPS/SOCKS5)
      public function setProxy($proxy_ip, $proxy_type = '')
      {
        $this->proxy = $proxy_ip;
        $this->proxy_type = $proxy_type;
      }
    
      //	Временное имя дsя cookie файла
      private function nameCookies($name = null)
      {
        for ($i=0; $i<10; ++$i)
                $name .= chr(rand(97, 122));
            return $name . '.temp';
      }
    
      //	Создание cookie файла
      public function setFileCookies()
      {
        $this->cookies = $this->nameCookies();
        file_put_contents($this->cookies, "");
      }
    
      //	Удаление cookie файла
      public function clearCookies()
      {
        unlink($this->cookies);
      }
    
      private function exec()
      {
        curl_setopt($this->ch, CURLOPT_URL, $this->url);
        curl_setopt($this->ch, CURLOPT_FOLLOWLOCATION , self::FOLLOWLOCATION);
        curl_setopt($this->ch, CURLOPT_AUTOREFERER, self::AUTOREFERER);
        curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, self::RETURNTRANSFER);	
        curl_setopt($this->ch, CURLOPT_HEADER, true);
        
        if ($this->postparams)
          curl_setopt($this->ch, CURLOPT_POSTFIELDS, $this->postparams);
        
        if (count($this->httpheaders))
          curl_setopt($this->ch, CURLOPT_HTTPHEADER, $this->httpheaders);
    
        if ($this->proxy)
          curl_setopt($this->ch, CURLOPT_PROXY, $this->setProxyIp());
          
        if ($this->proxy_type == 'socks5')
          curl_setopt($this->ch, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5);
    
        curl_setopt($this->ch, CURLOPT_TIMEOUT, self::TIMEOUT);
        curl_setopt($this->ch, CURLOPT_CONNECTTIMEOUT, self::CONNECT_TIME);
        curl_setopt($this->ch, CURLOPT_COOKIEJAR, $this->cookies);	//	Файл для записи cookies
       		curl_setopt($this->ch, CURLOPT_COOKIEFILE, $this->cookies);	//	Файл для чтения cookies
        $response = curl_exec($this->ch);
        $response = substr($response, curl_getinfo($this->ch, CURLINFO_HEADER_SIZE));
            
        $this->postparams = null;
        
        return $response;
      }
      
      public function __destruct()
      {
        curl_close($this->ch);
      }
    }


    как правильно вызвать?
    Раньще я вызывал $curl->setProxy('185.82.212.95:8080');