0
내가 다음에 수행 컬 나머지 웹 서비스를 호출하기 위해 노력하고있어 변경되지 않는다 그 기능들 중 하나는 혼자 일하고 있지만, 하나의 서비스에서 그들을 모을 때 다운로드 대화창은 열리지 않으며, 나는 항상 Content type으로 text/html을 얻습니다. 방화범을 통해 그것을 보았습니다.헤더의 "콘텐츠 유형은"
이 (php.ent에서) 다운로드의 코드입니다 :
if (file_exists($filename)) {
header("Content-Length: " . filesize($filename));
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename=' . $certName);
readfile($filename, false);
exit();
}
여기 내 서비스를 호출하는거야 방법은 다음과 같습니다
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, 1);
$dat=array(
// many args
);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_POSTFIELDS, $dat);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$data = curl_exec($ch);
$curl_errno = curl_errno($ch);
$curl_error = curl_error($ch);
if ($curl_errno > 0) {
echo "cURL Error ($curl_errno): $curl_error\n";
} else {
echo "Data received: $data\n";
}
curl_close($ch);
잘못들 무엇입니까?