#!/usr/bin/php $date, 'X-PDF-Alchemy-Signature'=>$signature); $options=array('headers'=>$headers); $response=http_request(HTTP_METH_PUT,"http://www.pdfalchemy.com$request",$body,$options,$info); if ($response===false) error_log('http_request returned false.'); else if ($info['response_code']==0) error_log('http_request returned response_code 0 - probably timed out.'); else if ($info['response_code']>=300) error_log("Failed to upload file: $response"); else print(ereg_replace('.*([0-9a-z]{8}(-[0-9a-z]{4}){3}-[0-9a-z]{12}).*',"\\1\n",$response)); } // Uploads all convertable files from a single directory, to PDF Alchemy. function uploadFilesInDir($dirname) { $dir=opendir($dirname); while (($filename=readdir($dir))!==false) if (ereg('\.(doc|docx|rtf|txt)$',$filename)>0) uploadFile($dirname.'/'.$filename); closedir($dir); } // Upload each directory / file. for ($index=1;$index