title: With php cURL get filename from file header
body: <p>I have this php cURL function: </p>
  
  <pre><code>function curl_login($url,$data,$proxy,$proxystatus){
  $fp = fopen("cookietlt.txt", "w");
  fclose($fp);
  $login = curl_init();
  curl_setopt($login, CURLOPT_COOKIEJAR, "cookie.txt");
  curl_setopt($login, CURLOPT_COOKIEFILE, "cookie.txt");
  curl_setopt($login, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)");
  curl_setopt($login, CURLOPT_TIMEOUT, 40);
  curl_setopt($login, CURLOPT_RETURNTRANSFER, TRUE);
  if ($proxystatus == 'on') {
      curl_setopt($login, CURLOPT_SSL_VERIFYHOST, FALSE);
      curl_setopt($login, CURLOPT_HTTPPROXYTUNNEL, TRUE);
      curl_setopt($login, CURLOPT_PROXY, $proxy);
  }
  curl_setopt($login, CURLOPT_URL, $url);
  curl_setopt($login, CURLOPT_HEADER, TRUE);
  curl_setopt($login, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
  curl_setopt($login, CURLOPT_FOLLOWLOCATION, TRUE);
  curl_setopt($login, CURLOPT_POST, TRUE);
  curl_setopt($login, CURLOPT_POSTFIELDS, $data);
  ob_start();      // prevent any output
  return curl_exec ($login); // execute the curl command
  ob_end_clean();  // stop preventing output
  
  curl_close ($login);
  
  unset($login);    
  }                  
  function curl_grab_page($site,$proxy,$proxystatus){
  $ch = curl_init();
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
  if ($proxystatus == 'on') {
      curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
      curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, TRUE);
      curl_setopt($ch, CURLOPT_PROXY, $proxy);
  }
  curl_setopt($ch, CURLOPT_COOKIEFILE, "cookie.txt");
  curl_setopt($ch, CURLOPT_URL, $site);
  ob_start();      // prevent any output
  return curl_exec ($ch); // execute the curl command
  ob_end_clean();  // stop preventing output
  curl_close ($ch);
  }
  
  
  curl_login('http://www.site.tdl/login.php','username=test&amp;password=demo','','off');
  curl_grab_page('http://www.site.tdl/1965.torrent','','off');
  </code></pre>
  
  <p>I need to get filename from file(<em><a href="http://www.site.tdl/1965.torrent" rel="nofollow noreferrer">http://www.site.tdl/1965.torrent</a></em>) header into variable. </p>
  
  <p><em><a href="http://www.site.tdl/1965.torrent" rel="nofollow noreferrer">http://www.site.tdl/1965.torrent</a></em> header:</p>
  
  <pre><code>Content-Disposition: attachment; filename="Linux.Mint.torrent"
  Content-Type: application/x-bittorrent
  Content-Length: 4525
  </code></pre>
  
  <p>So output will be Linux.Mint. How can I do that? </p>
  
  <p>Thanks!</p>