title: Curl get header with get not head request
body: <p>okey I made a script checking if file exist but the header I got from Curl is bad</p>
  
  <pre><code>  $curl = curl_init( $url );
    curl_setopt( $curl, CURLOPT_NOBODY, true );
    curl_setopt( $curl, CURLOPT_HEADER, true );
    curl_setopt( $curl, CURLOPT_RETURNTRANSFER, true );
    curl_setopt( $curl, CURLOPT_FOLLOWLOCATION, true );
    curl_setopt( $curl, CURLOPT_FRESH_CONNECT, true);
    $data = curl_exec( $curl );
    var_dump($data);
  </code></pre>
  
  <p>and it gets me response 200 while @file_headers() gets me boolean false, which is right file cant be downloaded (connection reset by peer)</p>
  
  <p>i'd use file_headers but its muuuch slower than curl (checking about 10k files)</p>
  
  <p>any idea how to fix curl to force it showing it correctly if file exist?</p>
  
  <p>FYI curl_getinfo($curl, CURLINFO_HTTP_CODE); 
  shows 200 too</p>
  
  <p><strong>*I mean if file is reset by peer, because cURL detects if file exist flawlessly (making Head request) while get_headers() use get request by default, is there a way to force cURL make get request?</strong></p>
  
  <p><strong>after adding curl_setopt( $curl, CURLOPT_HTTPGET,true); 
  When i log curl I see: * Empty reply from server, while getting "reset by peer" file but this is downloading my whole file</strong></p>
  
  <p>ok I think Ive made workaround adding curl_setopt( $curl, CURLOPT_RANGE, "1-1"); and downloading 1 byte instead getting header and if false then file does not exist or reset by peer</p>