title: PHP curl always returns http_code 0
body: <p>Hello StackOverflow community, I've encountered a problem when I try to use cURL methods on PHP. I tried with this sample code:</p>
  
  <pre><code>$html_brand = "www.google.com/";
  $ch = curl_init();
  
  $options = array(
      CURLOPT_URL            =&gt; $html_brand,
      CURLOPT_RETURNTRANSFER =&gt; true,
      CURLOPT_HEADER         =&gt; true,
      CURLOPT_HTTPHEADER     =&gt; array("User-Agent: Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36"),
      CURLOPT_FOLLOWLOCATION =&gt; true,
      CURLOPT_SSL_VERIFYPEER =&gt; false,
      CURLOPT_SSL_VERIFYHOST =&gt; false,
      CURLOPT_ENCODING       =&gt; "",
      CURLOPT_AUTOREFERER    =&gt; true,
      CURLOPT_CONNECTTIMEOUT =&gt; 120,
      CURLOPT_TIMEOUT        =&gt; 120,
      CURLOPT_MAXREDIRS      =&gt; 10,
  );
  curl_setopt_array( $ch, $options );
  $response = curl_exec($ch); 
  $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
  
  if ( $httpCode != 200 ){
      echo "Return code is {$httpCode} \n"
          .curl_error($ch);
  } else {
      echo "&lt;pre&gt;".htmlspecialchars($response)."&lt;/pre&gt;";
  }
  
  curl_close($ch);
  </code></pre>
  
  <p>And it always ends with an error, displaying it on screen:</p>
  
  <blockquote>
    <p>Return code is 0 Recv failure: Connection was reset</p>
  </blockquote>
  
  <p>Or this error, when trying to reach any site with https:</p>
  
  <blockquote>
    <p>Return code is 0 Failed to connect to www.google.com port 443: Timed
    out</p>
  </blockquote>
  
  <p>This are my settings:</p>
  
  <ul>
  <li>Windows 7 Professional 32 bit</li>
  <li>Apache 2.4.12</li>
  <li>PHP 5.6.11</li>
  </ul>
  
  <p>Is it a code error or any server configurations I have not considered?</p>
  
  <p>The <code>HTTP_HOST</code> value in Apache is <code>localhost:8080</code>, which I'm not really sure if it has anything to do with my problem, but maybe it's worth noting.</p>
  
  <p>Thank all of you in advance.</p>