Results 1 to 2 of 2
Mar 16, 2013, 21:44 #1
- Join Date
- Oct 2010
- 0 Post(s)
- 0 Thread(s)
Getting current source code into a variable
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" />
$html = $_POST['name'];