How can I use Curl to download a file in PHP if the headers are set to true? can I also get the filename and extension of file?

Example PHP code:

curl_setopt ($ch, CURLOPT_HEADER, 1);
$fp = fopen($strFilePath, 'w');
curl_setopt($ch, CURLOPT_FILE, $fp);
Edit
Report