i am sending request to a server using curl, the resonse of the request is zip file, i have to download it. but the data are show on the page on binarry format(junck character).

this is he code.

 $ch =curl_init();
 $headers=array("key: 2434jdfdf3433434"); 
 curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
 curl_setopt($ch, CURLOPT_URL,
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_BINARYTRANSFER,true);
curl_setopt($ch, CURLOPT_HTTPGET,true);
$output = curl_exec($ch);

if (empty($output))
    print "Sorry, the output is empty<p>";
    echo $output;


if i put this code ** header("Content-type:application/zip");** on the first line, i get save option, but its downloading the php file.


What are you asking? You are echoing the contents of a zip file so it will look like junk characters. You have to some how unzip the file either from the 'download' or via a php function.

Here is the PHP manual with all of the zip functions: http://php.net/manual/en/ref.zip.php