How to ensure PHP curl fully downloads pdf and pdftk command to skip damaged pdfs when merging -
How to ensure PHP curl fully downloads pdf and pdftk command to skip damaged pdfs when merging -
currently have php scrip downloads 50+ pdfs , merges them. when downloading not download pdf damaged. when executing merging command using pdftk throws exception because of damaged pdfs.
i using curl download pdfs, possible have check ensure file downloaded before downloading next one? or possible pdftk merge files skipping damaged ones?
below code:
downloading:
$fp = fopen($paths, 'w'); $ch = curl_init(); curl_setopt($ch,curlopt_url,$urls); curl_setopt($ch, curlopt_file, $fp); $data = curl_exec($ch); fclose($fp);
merging:
"c:\program files\pdf labs\pdftk server\bin\pdftk.exe" 1.pdf...0.pdf cat output %mydate%.pdf"
thanks in advance.
by using:
curl_setopt ($ch, curlopt_connecttimeout, 0); curl_setopt ($ch, curlopt_timeout, 0);
i can ensure pdf downloaded before proceeding download next one. solves issue.
hope helps.
php pdftk
Comments
Post a Comment