title: cURL response headers
body: <p>I am developing php application with cURL library.</p>
  
  <p>I would like to get redirect url (in case 301 or 302 http code). In Windows it is simple, I just need to call curl_getinfo($ch). This methods returns associative array with redirect_url, which I am using later.</p>
  
  <p>I have problem when I moved my application to linux server. Such method (curl_getinfo) returns array too, but there is no "redirect_url" index. I though I could try to read headers as a string. I set </p>
  
  <pre><code>curl_setopt(CURLOPT_HEADERFUNCTION, callback) 
  </code></pre>
  
  <p>and save response headers as a string. Then I use simple parser to get fields I am interested in. But now I have another problem. Redirect url (http header LOCATION) returns relative url (whereas in Windows it is absolute).</p>
  
  <p>Why there are differences in windows cURL and linux one? What can I do to make this application resistant to OS changes? And finally, how can I get this field (redirect url) as an absolute url in linux.</p>
  
  <p>Thanks for your help :)</p>
  
  <p>Sample from Windows:</p>
  
  <pre><code>Array
  (
  [url] =&gt; http:// wiadomosci.wp.pl/kat,1342,title,Ciag-dalszy-sporu-wokol-poslow-PiS-Nie-moge-tego-zrobic,wid,13927471,wiadomosc.html
  [content_type] =&gt; text/html
  [http_code] =&gt; 302
  [header_size] =&gt; 2407
  [request_size] =&gt; 384
  [filetime] =&gt; -1
  [ssl_verify_result] =&gt; 0
  [redirect_count] =&gt; 0
  [total_time] =&gt; 0.046
  [namelookup_time] =&gt; 0
  [connect_time] =&gt; 0.015
  [pretransfer_time] =&gt; 0.015
  [size_upload] =&gt; 0
  [size_download] =&gt; 0
  [speed_download] =&gt; 0
  [speed_upload] =&gt; 0
  [download_content_length] =&gt; 0
  [upload_content_length] =&gt; 0
  [starttransfer_time] =&gt; 0.046
  [redirect_time] =&gt; 0
  [certinfo] =&gt; Array
      (
      )
  
  [redirect_url] =&gt; http:// wiadomosci.wp.pl/kat,1342,title,Ciag-dalszy-sporu-wokol- poslow-PiS-Nie-moge-tego-zrobic,wid,13927471,wiadomosc.html?ticaid=1d436
  )
  </code></pre>
  
  <p>and windows:</p>
  
  <pre><code>Array
  (
  [url] =&gt; http:// wiadomosci.wp.pl/kat,1342,title,Ciag-dalszy-sporu-wokol-poslow-PiS-Nie-moge-tego-zrobic,wid,13927471,wiadomosc.html
  [content_type] =&gt; text/html
  [http_code] =&gt; 302
  [header_size] =&gt; 2425
  [request_size] =&gt; 384
  [filetime] =&gt; -1
  [ssl_verify_result] =&gt; 0
  [redirect_count] =&gt; 0
  [total_time] =&gt; 0.023254
  [namelookup_time] =&gt; 0.001938
  [connect_time] =&gt; 0.004836
  [pretransfer_time] =&gt; 0.004847
  [size_upload] =&gt; 0
  [size_download] =&gt; 0
  [speed_download] =&gt; 0
  [speed_upload] =&gt; 0
  [download_content_length] =&gt; 0
  [upload_content_length] =&gt; 0
  [starttransfer_time] =&gt; 0.023068
  [redirect_time] =&gt; 0
  [certinfo] =&gt; Array
      (
      )
  )
  </code></pre>