Answer the question
In order to leave comments, you need to log in
How to save a PDF received in response to a CURL POST request?
The following task appeared:
1. I submit the necessary POST request to the resource
2. In response, it issues an HTTP page + PDF file.
3. I display CURL's response to the browser, and there is first an HTML file, and then a PDF binary.
The question is how to correctly extract this PDF from the answer and save it? Does CURL have any built-in mechanisms for this?
Answer the question
In order to leave comments, you need to log in
Answer to your own question: use:
$pdf_file = fopen(путь до сохраняемого файла на диске, 'w+');
... все дела
curl_setopt($ch, CURLOPT_FILE, $pdf_file);
... все дела
fclose($pdf_file);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question