/** Executes the Single or Multiple Requests */ private static function _curl_init($uri, $head = null) { self::$_ch = curl_init($uri); self::$_ch_head = null; // Booleans curl_setopt(self::$_ch, CURLOPT_AUTOREFERER, true); curl_setopt(self::$_ch, CURLOPT_BINARYTRANSFER, true); curl_setopt(self::$_ch, CURLOPT_COOKIESESSION, false); curl_setopt(self::$_ch, CURLOPT_CRLF, false); curl_setopt(self::$_ch, CURLOPT_FAILONERROR, false); curl_setopt(self::$_ch, CURLOPT_FILETIME, true); curl_setopt(self::$_ch, CURLOPT_FOLLOWLOCATION, false); curl_setopt(self::$_ch, CURLOPT_FORBID_REUSE, true); curl_setopt(self::$_ch, CURLOPT_FRESH_CONNECT, true); curl_setopt(self::$_ch, CURLOPT_HEADER, false); curl_setopt(self::$_ch, CURLOPT_NETRC, false); curl_setopt(self::$_ch, CURLOPT_RETURNTRANSFER, true); curl_setopt(self::$_ch, CURLOPT_SSL_VERIFYPEER, false); // curl_setopt(self::$_ch, CURLOPT_VERBOSE, true); // if ( (!empty(self::$_opts['verbose'])) && (is_resource(self::$_opts['verbose'])) ) { // curl_setopt(self::$_ch, CURLOPT_VERBOSE, true); // curl_setopt(self::$_ch, CURLOPT_STDERR, self::$_opts['verbose']); // } curl_setopt(self::$_ch, CURLOPT_BUFFERSIZE, 16384); curl_setopt(self::$_ch, CURLOPT_CONNECTTIMEOUT, 15); curl_setopt(self::$_ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); curl_setopt(self::$_ch, CURLOPT_MAXREDIRS, 0); curl_setopt(self::$_ch, CURLOPT_SSL_VERIFYHOST, 0); // curl_setopt(self::$_ch, CURLOPT_SSLVERSION, 3); // 2, 3 or GnuTLS curl_setopt(self::$_ch, CURLOPT_TIMEOUT, self::$_opts['timeout']); curl_setopt(self::$_ch, CURLOPT_USERAGENT, self::$_opts['user-agent']); if (!empty($head) && is_array($head)) { curl_setopt(self::$_ch, CURLOPT_HTTPHEADER, $head); } if (!empty(self::$_opts['cookie'])) { curl_setopt(self::$_ch, CURLOPT_COOKIEFILE, self::$_opts['cookie']); curl_setopt(self::$_ch, CURLOPT_COOKIEJAR, self::$_opts['cookie']); } curl_setopt(self::$_ch, CURLOPT_HEADERFUNCTION, array('self', '_curl_head')); return self::$_ch; }