Hello,
I am trying to use a service called PdfMyURL.com. This allows you to send a request to their server via a browser with a GET variable of the URL you want converted to a PDF, then sends it back in the headers where you get a dialog to save or open. For an example of what this does copy and paste the following URL into your browser:
http://pdfmyurl.com?url=www.google.com
I would like to do this with PHP and rather than save it to the client, save it to the server in the background. I can’t figure out how to grab the file from the headers and move it to a location on the server. Heres what I have.
<?
$content = file_get_contents('http://pdfmyurl.com?url=www.google.com');
if ($content !== false) {
//save action at this point.
echo "$content";
// Its kinda working because this will puke out the PDF file
// contents as all the jimmerish.
}
?>
I have tried use fopen and fwrite but to no avail. This works (kinda) except I think it reads the contents of the headers as well into the file because the PDF file it saves will not open but is about the correct file size. Anyone have any ideas. Thanks and I hope someone out there has come accross this before.