is there any way to retrieve binary data file send as response for POST request?
I.e. You customize your package in some page, than click Submit and HTTP server resposne for this POST request with ZIP archive.
I know that I can send POST request with cURL, but whats next to do? How to retrieve this file?
Thanks
Use cURL to send the POST request (I'm not showing that part of the code, you said you know how to do that). The returned response will be the contents of the ZIP file. You can then save it in a local file, or send it to the client; I show the first option below.
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
...
$result = curl_exec($ch);
file_put_contents("foo.zip", $result);
You can also use the CURLOPT_FILE
option to write directly to the file instead of using a variable first:
$fh = fopen("foo.zip", "w");
curl_setopt($ch, CURLOPT_FILE, $fh);
close($fh);
One solution might be to have the server put this Zip archive together and then send the link in the Post response back.