I have a page on my website that pulls out information from a table and is formatted with css.
I can't find a way to save the page as is, as a text or pdf file. I found a pdf site that does this http://pdfmyurl.com/ but I was hoping to do the same thing on my own site wihtout external sites.
The web page has a session making sure the user is logged in, and depending on the user_id depends what data is pulled out the database. To clarify, I want the users to be able to view this page. On the page I was hoping for a "SAVE TO COMPUTER" button that would save that page as is.
I found
<?php
//Link to download file...
$url = "savechoice.php";
//Code to get the file...
$data = file_get_contents($url);
//save as?
$filename = "test.txt";
//save the file...
$fh = fopen($filename,"w");
fwrite($fh,$data);
fclose($fh);
//display link to the file you just saved...
echo "<a href='".$filename."'>Click Here</a> to download the file...";
?>
But this just saves the page as text including the php not executed. I also changed the url to the full url and although running the PHP comes back blank as the session isn't recognised.