title: PHP cURL Problems: HTTP Code 0
body: <p>I am trying to bring up a website/API through cURL and PHP. Whatever URL I try I am getting an HTTP Code of 0. I have tried several different URLs. No matter what I try I am getting the following curl_getinfo back (see below). I have verified that cURL is enabled in PHP.ini file.</p>
  
  <p>Code:</p>
  
  <pre><code> // create a new cURL resource
  $ch = curl_init();
  
  // set URL and other appropriate options
  curl_setopt($ch, CURLOPT_URL, "http://www.yahoo.com");
  curl_setopt($ch, CURLOPT_HEADER, 1);
  curl_setopt($ch, CURLOPT_POST, TRUE);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
  curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
  curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
  
  $report=curl_getinfo($ch);
  print_r($report);
  
  // grab URL and pass it to the browser
  curl_exec($ch);
  
  if(curl_errno($ch)) {
     echo 'Curl error: ' . curl_error($ch);
  }
  
  print curl_error($ch);
  
  // close cURL resource, and free up system resources
  curl_close($ch);
  </code></pre>
  
  <p>cURL_getinfo:</p>
  
  <pre><code> Array
  (
  [url] =&gt; http://www.yahoo.com
  [content_type] =&gt; 
  [http_code] =&gt; 0
  [header_size] =&gt; 0
  [request_size] =&gt; 0
  [filetime] =&gt; 0
  [ssl_verify_result] =&gt; 0
  [redirect_count] =&gt; 0
  [total_time] =&gt; 0
  [namelookup_time] =&gt; 0
  [connect_time] =&gt; 0
  [pretransfer_time] =&gt; 0
  [size_upload] =&gt; 0
  [size_download] =&gt; 0
  [speed_download] =&gt; 0
  [speed_upload] =&gt; 0
  [download_content_length] =&gt; -1
  [upload_content_length] =&gt; -1
  [starttransfer_time] =&gt; 0
  [redirect_time] =&gt; 0
  [certinfo] =&gt; Array
      (
      )
  
  [primary_ip] =&gt; 
  [primary_port] =&gt; 0
  [local_ip] =&gt; 
  [local_port] =&gt; 0
  [redirect_url] =&gt; 
   )
  </code></pre>