title: CURL error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol
body: <p>I'm trying to use proxy and SSL certificate with <code>CURL</code>, But I get errors.</p>
  
  <p>Here is the <code>CURL</code> code:</p>
  
  <pre><code>//Website
  $url = 'https://www.stubhub.com';
  
  //Curl
  $curl=curl_init();
  
  //SSL
  curl_setopt( $curl, CURLOPT_SSL_VERIFYPEER, true );
  curl_setopt( $curl, CURLOPT_SSL_VERIFYHOST, 2 );
  curl_setopt( $curl, CURLOPT_CAINFO, 'C:\xampp\cacert.pem' );
  
  curl_setopt( $curl, CURLOPT_URL,trim( $url ) );
  curl_setopt($curl, CURLOPT_REFERER, $url);
  curl_setopt( $curl, CURLOPT_AUTOREFERER, true );
  curl_setopt( $curl, CURLOPT_FOLLOWLOCATION, true );
  curl_setopt( $curl, CURLOPT_FAILONERROR, true );
  curl_setopt( $curl, CURLOPT_HEADER, false );
  curl_setopt( $curl, CURLINFO_HEADER_OUT, false );
  curl_setopt( $curl, CURLOPT_RETURNTRANSFER, true );
  curl_setopt( $curl, CURLOPT_BINARYTRANSFER, true );
  curl_setopt( $curl, CURLOPT_CONNECTTIMEOUT, 0 );
  curl_setopt( $curl, CURLOPT_TIMEOUT, 0 );
  curl_setopt( $curl, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36' );
  
  //Proxy
  curl_setopt($curl, CURLOPT_HTTPPROXYTUNNEL, 1);
  curl_setopt($curl, CURLOPT_PROXY, '177.190.147.241:41545');
  curl_setopt($curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
  curl_setopt ($curl, CURLOPT_PORT , 80);
  
  curl_setopt($curl, CURLOPT_COOKIEFILE,__DIR__."/cookie.txt");
  curl_setopt( $curl, CURLOPT_MAXREDIRS, 10 );
  curl_setopt( $curl, CURLOPT_ENCODING, '' );
  
  curl_setopt( $curl, CURLOPT_VERBOSE, true );
  curl_setopt( $curl, CURLOPT_NOPROGRESS, true );
  curl_setopt( $curl, CURLOPT_STDERR, $vbh );
  </code></pre>
  
  <p>I get the following response:</p>
  
  <pre><code>* Rebuilt URL to: https://www.stubhub.com/
  *   Trying 177.190.147.241...
  * TCP_NODELAY set
  * Connected to 177.190.147.241 (177.190.147.241) port 41545 (#0)
  * Establish HTTP proxy tunnel to www.stubhub.com:80
  &gt; CONNECT www.stubhub.com:80 HTTP/1.1
  Host: www.stubhub.com:80
  User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/22.0.1207.1 Safari/537.1
  Proxy-Connection: Keep-Alive
  
  &lt; HTTP/1.1 200 OK
  &lt; 
  * Proxy replied OK to CONNECT request
  * ALPN, offering http/1.1
  * Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH
  * successfully set certificate verify locations:
  *   CAfile: C:\xampp\cacert.pem
    CApath: none
  * error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol
  * Curl_http_done: called premature == 1
  * Closing connection 0
  error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol
  </code></pre>
  
  <p>How to fix this?</p>