hi
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,
'https://xyz.com/api/batches/1481307454804189100');
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_BINARYTRANSFER,true);
curl_setopt($ch, CURLOPT_HTTPGET,true);
$output = curl_exec($ch);
curl_close($ch);
if (empty($output))
{
print "Sorry, the output is empty<p>";
}
else
{
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.
regards
rajan