$text = $response;
$fp = fopen("file.pdf", "w");
fwrite($fp, $text);
fclose($fp);
header('Content-Type: application/pdf');
echo $string;
Но мне бы не хотелось хранить этот файл на сервере.
$text = $response;
$pdfname = 'myCoolPDF';
header('Content-Type: text/html; charset=UTF-8');
header('Expires: Mon, 30 Jul 1997 05:00:00 GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', FALSE);
header('Pragma: no-cache');
header('Content-transfer-encoding: binary');
header('Content-Disposition: inline; filename='.$pdfsendname.'.pdf');
header('Content-Type: application/pdf');
echo $text;