src/Connector.php
private function &getHandle($url, $headers)
    {
        $http = curl_init();

        curl_setopt($http, CURLOPT_USERAGENT, $this->getUserAgent());
        curl_setopt($http, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($http, CURLINFO_HEADER_OUT, true);
        curl_setopt($http, CURLOPT_URL, $url);

        if (!$this->getSslVerifyPeer()) {
            curl_setopt($http, CURLOPT_SSL_VERIFYPEER, false);
            curl_setopt($http, CURLOPT_SSL_VERIFYHOST, false);
        }

        if (is_array($headers) && count($headers)) {
            curl_setopt($http, CURLOPT_HTTPHEADER, $headers);
        }

        $this->response_headers = [];

        curl_setopt(
            $http,
            CURLOPT_HEADERFUNCTION,
            function($curl, $header) {
                $len = strlen($header);
                $header = explode(':', $header, 2);

                if (count($header) < 2) {
                    return $len;
                }

                $name = strtolower(trim($header[0]));

                if (!array_key_exists($name, $this->response_headers)) {
                    $this->response_headers[$name] = [trim($header[1])];
                } else {
                    $this->response_headers[$name][] = trim($header[1]);
                }

                return $len;
            }
        );

        return $http;
    }
private function &getHandle($url, $headers)
    {
        $http = curl_init();

        curl_setopt($http, CURLOPT_USERAGENT, $this->getUserAgent());
        curl_setopt($http, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($http, CURLINFO_HEADER_OUT, true);
        curl_setopt($http, CURLOPT_URL, $url);

        if (!$this->getSslVerifyPeer()) {
            curl_setopt($http, CURLOPT_SSL_VERIFYPEER, false);
            curl_setopt($http, CURLOPT_SSL_VERIFYHOST, false);
        }

        if (is_array($headers) && count($headers)) {
            curl_setopt($http, CURLOPT_HTTPHEADER, $headers);
        }

        $this->response_headers = [];

        curl_setopt(
            $http,
            CURLOPT_HEADERFUNCTION,
            function($curl, $header) {
                $len = strlen($header);
                $header = explode(':', $header, 2);

                if (count($header) < 2) {
                    return $len;
                }

                $name = strtolower(trim($header[0]));

                if (!array_key_exists($name, $this->response_headers)) {
                    $this->response_headers[$name] = [trim($header[1])];
                } else {
                    $this->response_headers[$name][] = trim($header[1]);
                }

                return $len;
            }
        );

        return $http;
    }
private function & getHandle ( $ url , $ headers ) { $ http = curl_init ( ) ; curl_setopt ( $ http , CURLOPT_USERAGENT , $ this -> getUserAgent ( ) ) ; curl_setopt ( $ http , CURLOPT_RETURNTRANSFER , true ) ; curl_setopt ( $ http , CURLINFO_HEADER_OUT , true ) ; curl_setopt ( $ http , CURLOPT_URL , $ url ) ; if ( ! $ this -> getSslVerifyPeer ( ) ) { curl_setopt ( $ http , CURLOPT_SSL_VERIFYPEER , false ) ; curl_setopt ( $ http , CURLOPT_SSL_VERIFYHOST , false ) ; } if ( is_array ( $ headers ) && count ( $ headers ) ) { curl_setopt ( $ http , CURLOPT_HTTPHEADER , $ headers ) ; } $ this -> response_headers = [ ] ; curl_setopt ( $ http , CURLOPT_HEADERFUNCTION , function ( $ curl , $ header ) { $ len = strlen ( $ header ) ; $ header = explode ( ':' , $ header , 2 ) ; if ( count ( $ header ) < 2 ) { return $ len ; } $ name = strtolower ( trim ( $ header [ 0 ] ) ) ; if ( ! array_key_exists ( $ name , $ this -> response_headers ) ) { $ this -> response_headers [ $ name ] = [ trim ( $ header [ 1 ] ) ] ; } else { $ this -> response_headers [ $ name ] [ ] = trim ( $ header [ 1 ] ) ; } return $ len ; } ) ; return $ http ; }
Return curl resource.

@param  string     $url
@param  array|null $headers
@return resource
Return curl resource .