Hi all,
I’m having a bit of a headache with this… I have a page that is dynamically generated by a PHP Code. It is a personalised astrology report. I am trying to add the ability to download the page as a PDF File. I am trying to use something called DOMPDF but my first hurdle is getting the current page’s source code into a variable.
I have tried using file_get_contents() but it always returns blank! I assume that is because the page is dynamically created.
Is there a way I can get the HTML Source Code of the current page AFTER it has rendered and then store it into a variable which I can then pass through a form to my dompdf script…
for example, this is what I have so far:
<?php $pdfhtml = file_get_contents(); ?>
<form action="pdfscript.php" method="post" name="pdf">
<input type="hidden" name="html" value="<?php echo $pdfhtml; ?>" />
<input type="submit" value="Download" />
</form>
And then my pdfscript.php file is fetching the “html” value like this:
$html = $_POST['name'];
echo $html;
But it is always blank!
Help Please???