Jump to content


Help saving dynamic page to a static file

  • Please log in to reply
1 reply to this topic

#1 diar33

  • Members
  • PipPip
  • Member
  • 13 posts

Posted 27 October 2006 - 06:59 PM

Hi everyone,

I am having quite a bit of trouble with a small project of mine. What I am trying to do is take an existing html result page (comes from php, pulls lots of stuff from a database and requires authentication) and turn it into a file I can attach to an e-mail. I would really prefer .pdf, but .doc or .html would be fine. I got it to work with .doc using mime-types and some word xml, but it looks terrible. I also tried .html using curl to open the page and write it to a file, but I couldn't get it to pass the authentication.

Any ideas how I can do this?

To summarize: I just want to be able to send a member of the site a record of their information. If it would be helpful to know more about my specific problem, please let me know.

Thanks in advance,


#2 ksteuber

  • Members
  • PipPipPip
  • Advanced Member
  • 32 posts
  • LocationCalifornia, USA

Posted 28 October 2006 - 03:57 AM

Well it seems like the html file ought to be fairly easy.

I'm having a hard time understanding exactly where the information is comming from, but if I understand right, you want something like:
$username = $_POST['username'];
$userinfo1 = $_POST['userinfo1'];
$userinfo2 = $_POST['userinfo2'];
$html="<html><head><title></title></head><body><h1>This is Important User Information:</h1><table><tr><td>Piece of Information #1</td><td>$userinfo1</td></tr><tr><td>Piece of Information #2</td><td>$userinfo2</td></tr></table></body></html>";

$handle = fopen($username.".html", "w");
fwrite($handle, $html);

Is this the sort of thing you were looking for?

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users