Save a dynamically generated PDF file from a URL to disk. The PDF file is generated using ASPX on a url, sample url -
I have tried the basic file_get_contents but it saves an empty file.
http://url-address/LabReport_Interface.aspx?TestID=LSHHI764&PID=LSHHI637515&LedgerTransactionNo=401411000222
$handle = fopen("./reports/test.pdf", "wb");
if (fwrite($handle, file_get_contents($url)) === FALSE) {
echo "Cannot write to file ($filename)";
}
fclose($handle);
Thanks in advance. Any other turnaround would also be appreciated.
I have found the solution, I used a perl call from php and saved pdf using perl's www-mechanize