可以说,在您填写表格后,结果将变为
http://www.example.com/invoices/download/result.html
您可以执行以下操作以将 html 中的 curl 响应转换为 pdf。
$ch = curl_init("http://www.example.com/invoices/download/result.html");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_BINARYTRANSFER, true);
$content = curl_exec($ch);
header('Cache-Control: public');
header('Content-type: application/pdf');
header('Content-Disposition: attachment; filename="my_file.pdf"');
header('Content-Length: '.strlen($content));
echo $content;