Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ionic-framework/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何提高旋度课_Php_Curl - Fatal编程技术网

Php 如何提高旋度课

Php 如何提高旋度课,php,curl,Php,Curl,我需要帮助来调整这个卷发 我在sql表中有100行将调用curl类 $curl = new cURL(); $q=$sql->query("SELECT * FROM users limit $start,$limi"); while($r = $sql->fetch($q)) { $curl->cURL($r['proxy'],$r['ip']); $curl->proc('http://site.info/index.php',array('name'=>'u

我需要帮助来调整这个卷发

我在sql表中有100行将调用curl类

$curl = new cURL();
$q=$sql->query("SELECT * FROM users limit $start,$limi");
while($r = $sql->fetch($q))
{

$curl->cURL($r['proxy'],$r['ip']);
$curl->proc('http://site.info/index.php',array('name'=>'username','password'=>'pass123'));
}
class cURL {

    public $headers;
    public $user_agent;
    public $compression;
    public $agent;
    public $proxy;
    public $process;
    public $url;
     public $cookie;
     public $path;

    public function __construct() {

        $this->process = curl_init();

    }

    public function cURL($proxy,$agent) {
        $this->headers[] = 'Connection: Keep-Alive';
        $this->headers[] = 'charset=UTF-8';
        $this->user_agent = $agent;
        $this->compression = 'gzip,deflate';
        $this->proxy = $proxy;
        $this->agent = $agent;
        $this->path  = dirname(__FILE__) .'\temp\/';
        $this->cookie  = $this->path .'cookie.txt';
        if (!is_dir($this->path)) mkdir($this->path, 0755, true);
    }



    public function proc($url,$data=null,$nobody=false) {
        curl_setopt($this->process, CURLOPT_URL, $url);
        curl_setopt($this->process, CURLOPT_NOBODY,$nobody);
        curl_setopt($this->process, CURLOPT_HEADER,false);
        curl_setopt($this->process, CURLOPT_HTTPHEADER, $this->headers);
        curl_setopt($this->process, CURLOPT_USERAGENT, $this->user_agent);
        curl_setopt($this->process, CURLOPT_COOKIEFILE, $this->cookie);
        curl_setopt($this->process, CURLOPT_COOKIEJAR, $this->cookie);
        curl_setopt($this->process, CURLOPT_COOKIE, "cookiename=0");
        curl_setopt($this->process, CURLOPT_SSL_VERIFYHOST, 0);
        curl_setopt($this->process, CURLOPT_ENCODING, $this->compression);
        curl_setopt($this->process, CURLOPT_TIMEOUT, 10);
        curl_setopt($this->process, CURLOPT_PROXY, $this->proxy);
        curl_setopt($this->process, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($this->process, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4 );
        curl_setopt($this->process, CURLOPT_REFERER, $_SERVER['REQUEST_URI']);
        curl_setopt($this->process, CURLOPT_SSL_VERIFYPEER, 0);
        curl_setopt($this->process, CURLOPT_FOLLOWLOCATION, 0);

        if (strpos(curl_exec($this->process),'Login') !==false){

        curl_setopt($this->process, CURLOPT_CUSTOMREQUEST, "POST");
        curl_setopt($this->process, CURLOPT_POST, 1);
        curl_setopt($this->process, CURLOPT_POSTFIELDS, $data);
         }


         return curl_exec($this->process);

    }

}   
现在我们去上旋度课

$curl = new cURL();
$q=$sql->query("SELECT * FROM users limit $start,$limi");
while($r = $sql->fetch($q))
{

$curl->cURL($r['proxy'],$r['ip']);
$curl->proc('http://site.info/index.php',array('name'=>'username','password'=>'pass123'));
}
class cURL {

    public $headers;
    public $user_agent;
    public $compression;
    public $agent;
    public $proxy;
    public $process;
    public $url;
     public $cookie;
     public $path;

    public function __construct() {

        $this->process = curl_init();

    }

    public function cURL($proxy,$agent) {
        $this->headers[] = 'Connection: Keep-Alive';
        $this->headers[] = 'charset=UTF-8';
        $this->user_agent = $agent;
        $this->compression = 'gzip,deflate';
        $this->proxy = $proxy;
        $this->agent = $agent;
        $this->path  = dirname(__FILE__) .'\temp\/';
        $this->cookie  = $this->path .'cookie.txt';
        if (!is_dir($this->path)) mkdir($this->path, 0755, true);
    }



    public function proc($url,$data=null,$nobody=false) {
        curl_setopt($this->process, CURLOPT_URL, $url);
        curl_setopt($this->process, CURLOPT_NOBODY,$nobody);
        curl_setopt($this->process, CURLOPT_HEADER,false);
        curl_setopt($this->process, CURLOPT_HTTPHEADER, $this->headers);
        curl_setopt($this->process, CURLOPT_USERAGENT, $this->user_agent);
        curl_setopt($this->process, CURLOPT_COOKIEFILE, $this->cookie);
        curl_setopt($this->process, CURLOPT_COOKIEJAR, $this->cookie);
        curl_setopt($this->process, CURLOPT_COOKIE, "cookiename=0");
        curl_setopt($this->process, CURLOPT_SSL_VERIFYHOST, 0);
        curl_setopt($this->process, CURLOPT_ENCODING, $this->compression);
        curl_setopt($this->process, CURLOPT_TIMEOUT, 10);
        curl_setopt($this->process, CURLOPT_PROXY, $this->proxy);
        curl_setopt($this->process, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($this->process, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4 );
        curl_setopt($this->process, CURLOPT_REFERER, $_SERVER['REQUEST_URI']);
        curl_setopt($this->process, CURLOPT_SSL_VERIFYPEER, 0);
        curl_setopt($this->process, CURLOPT_FOLLOWLOCATION, 0);

        if (strpos(curl_exec($this->process),'Login') !==false){

        curl_setopt($this->process, CURLOPT_CUSTOMREQUEST, "POST");
        curl_setopt($this->process, CURLOPT_POST, 1);
        curl_setopt($this->process, CURLOPT_POSTFIELDS, $data);
         }


         return curl_exec($this->process);

    }

}   
sql while循环的问题限制了20个用户

每个调用curl函数都会打开索引页,如果cookie过期,则会发布登录数据并转到

  • 如果我的条件是pass,打开索引并获取一些数据将调用函数$curl->proc()并发布新数据

  • 打开第2页并获取一些数据,如果我的条件是pass,将调用函数$curl->proc()并发布新数据

  • 打开第3页并获取一些数据,如果我的条件是pass,将调用函数$curl->proc()并发布新数据

  • 所有这些操作都将在循环中一个接一个地运行,而这是问题1

    第2期 有一段时间需要在没有代理的情况下调用页面,我被设置为proxy$curl->curl($r['proxy'],$r['ip'])

    想要的东西

  • 在我的例子中,什么是最好的curl\u init或culr\u multi\u init
  • 如何在最短的时间内提高课堂教学效果
  • 将Response保存到硬盘,并使用file_get_内容预存或直接从Response使用预存更快
  • 有提高质量和速度的技巧吗
  • 多谢各位