private static function curlInit($proxy) {
        $ch = curl_init();
        curl_setopt_array($ch, array(
            CURLOPT_FOLLOWLOCATION => !ini_get('safe_mode') && (string)ini_get('open_basedir') === '',
            CURLOPT_RETURNTRANSFER => true,
            CURLOPT_SSL_VERIFYPEER => true,
            CURLOPT_ENCODING       => 'gzip',
            CURLOPT_COOKIEJAR      => '',
            CURLOPT_CONNECTTIMEOUT => self::CURLOPT_CONNECTTIMEOUT,
            CURLOPT_TIMEOUT        => self::CURLOPT_TIMEOUT,
        ));
        if ($proxy !== '') {
            if (false === $p = parse_url($proxy)) {
                throw new TwistException('The value of $proxy is invalid: Failed to parse.');
            }
            if (!isset($p['scheme'])) {
                throw new TwistException('The value of $proxy is invalid: Has no scheme.');
            }
            if (!isset($p['host'])) {
                throw new TwistException('The value of $proxy is invalid: Has no host.');
            }
            if (isset($p['path'])) {
                throw new TwistException('The value of $proxy is invalid: Has path.');
            }
            if (isset($p['query'])) {
                throw new TwistException('The value of $proxy is invalid: Has query.');
            }
            if (isset($p['fragment'])) {
                throw new TwistException('The value of $proxy is invalid: Has fragment.');
            }
            curl_setopt_array($ch, array(
                CURLOPT_HTTPPROXYTUNNEL => $p['scheme'] === 'https',
                CURLOPT_PROXY           => $p['scheme'] . '://' . $p['host'] . (isset($p['port']) ? ':' . $p['port'] : ''),
                CURLOPT_PROXYUSERPWD    => (isset($p['user']) ? $p['user'] : 'anonymous') . ':' . (isset($p['pass']) ? $p['pass'] : ''),
            ));
            if (isset($p['port'])) {
                curl_setopt($ch, CURLOPT_PROXYPORT, $p['port']);
            }
        }
        return $ch;
    }
private static function curlInit($proxy) {
        $ch = curl_init();
        curl_setopt_array($ch, array(
            CURLOPT_FOLLOWLOCATION => !ini_get('safe_mode') && (string)ini_get('open_basedir') === '',
            CURLOPT_RETURNTRANSFER => true,
            CURLOPT_SSL_VERIFYPEER => true,
            CURLOPT_ENCODING       => 'gzip',
            CURLOPT_COOKIEJAR      => '',
            CURLOPT_CONNECTTIMEOUT => self::CURLOPT_CONNECTTIMEOUT,
            CURLOPT_TIMEOUT        => self::CURLOPT_TIMEOUT,
        ));
        if ($proxy !== '') {
            if (false === $p = parse_url($proxy)) {
                throw new TwistException('The value of $proxy is invalid: Failed to parse.');
            }
            if (!isset($p['scheme'])) {
                throw new TwistException('The value of $proxy is invalid: Has no scheme.');
            }
            if (!isset($p['host'])) {
                throw new TwistException('The value of $proxy is invalid: Has no host.');
            }
            if (isset($p['path'])) {
                throw new TwistException('The value of $proxy is invalid: Has path.');
            }
            if (isset($p['query'])) {
                throw new TwistException('The value of $proxy is invalid: Has query.');
            }
            if (isset($p['fragment'])) {
                throw new TwistException('The value of $proxy is invalid: Has fragment.');
            }
            curl_setopt_array($ch, array(
                CURLOPT_HTTPPROXYTUNNEL => $p['scheme'] === 'https',
                CURLOPT_PROXY           => $p['scheme'] . '://' . $p['host'] . (isset($p['port']) ? ':' . $p['port'] : ''),
                CURLOPT_PROXYUSERPWD    => (isset($p['user']) ? $p['user'] : 'anonymous') . ':' . (isset($p['pass']) ? $p['pass'] : ''),
            ));
            if (isset($p['port'])) {
                curl_setopt($ch, CURLOPT_PROXYPORT, $p['port']);
            }
        }
        return $ch;
    }
private static function curlInit ( $ proxy ) { $ ch = curl_init ( ) ; curl_setopt_array ( $ ch , array ( CURLOPT_FOLLOWLOCATION => ! ini_get ( 'safe_mode' ) && ( string ) ini_get ( 'open_basedir' ) === '' , CURLOPT_RETURNTRANSFER => true , CURLOPT_SSL_VERIFYPEER => true , CURLOPT_ENCODING => 'gzip' , CURLOPT_COOKIEJAR => '' , CURLOPT_CONNECTTIMEOUT => self :: CURLOPT_CONNECTTIMEOUT , CURLOPT_TIMEOUT => self :: CURLOPT_TIMEOUT , ) ) ; if ( $ proxy !== '' ) { if ( false === $ p = parse_url ( $ proxy ) ) { throw new TwistException ( 'The value of $proxy is invalid: Failed to parse.' ) ; } if ( ! isset ( $ p [ 'scheme' ] ) ) { throw new TwistException ( 'The value of $proxy is invalid: Has no scheme.' ) ; } if ( ! isset ( $ p [ 'host' ] ) ) { throw new TwistException ( 'The value of $proxy is invalid: Has no host.' ) ; } if ( isset ( $ p [ 'path' ] ) ) { throw new TwistException ( 'The value of $proxy is invalid: Has path.' ) ; } if ( isset ( $ p [ 'query' ] ) ) { throw new TwistException ( 'The value of $proxy is invalid: Has query.' ) ; } if ( isset ( $ p [ 'fragment' ] ) ) { throw new TwistException ( 'The value of $proxy is invalid: Has fragment.' ) ; } curl_setopt_array ( $ ch , array ( CURLOPT_HTTPPROXYTUNNEL => $ p [ 'scheme' ] === 'https' , CURLOPT_PROXY => $ p [ 'scheme' ] . '://' . $ p [ 'host' ] . ( isset ( $ p [ 'port' ] ) ? ':' . $ p [ 'port' ] : '' ) , CURLOPT_PROXYUSERPWD => ( isset ( $ p [ 'user' ] ) ? $ p [ 'user' ] : 'anonymous' ) . ':' . ( isset ( $ p [ 'pass' ] ) ? $ p [ 'pass' ] : '' ) , ) ) ; if ( isset ( $ p [ 'port' ] ) ) { curl_setopt ( $ ch , CURLOPT_PROXYPORT , $ p [ 'port' ] ) ; } } return $ ch ; }
Initialize cURL resource.

@proxy string $proxy
@return resource cURL
Initialize cURL resource .