Re: Seeking a function, class or other means to save the current PHP page as an HTML file on the server.
| From: | TG | Date: | Fri, 07 Mar 2008 03:00:33 +0000 |
| Subject: | Re: Seeking a function, class or other means to save the current PHP page as an HTML file on the server. | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-28818@lists.php.net to get a copy of this message | ||
Yeah, the trick is you want to force the download. If you send HTML or text
without setting the disposition properly, it'll just display in the
browser. Maybe something like this will help:
http://www.boutell.com/newfaq/creating/forcedownload.html
Good luck!
-TG
----- Original Message -----
From: "Michael Southworth" <mikesouthworth@gmail.com>
To: "Greg Cocks" <gcocks@stoller.com>
Cc: php-windows@lists.php.net
Date: Thu, 6 Mar 2008 17:40:04 -0800
Subject: Re: [PHP-WIN] Seeking a function, class or other means to save the
current PHP page as an HTML file on the server.
> As a quick answer, I think the easiest way is to have a link reload the
> page, with a flag to set the content disposition header.
> See:
> http://us3.php.net/header
> Example #1
> It should be fairly straightforward from there. If I do recall, there may be
> some quirks with IE, a quick google should bring up any workarounds.
>
> If you cannot allow a refresh, the solution may be far more complicated,
> using the document object model in javascript, or php output control. In
> that case, I would ask your users to just use the Save-as function instead.
>
> HTH,
> -Michael
>
> On Thu, Mar 6, 2008 at 5:21 PM, Greg Cocks <gcocks@stoller.com> wrote:
>
> > Hello,
> >
> >
> >
> > I am seeking a function, class or other means to save the current PHP
> > page as an HTML file on the server.
> >
> >
> >
> > The user, via a button, could then 'download' this page much like if
> > they had gone to their "File... Save Page As.." menu to save it locally.
> >
> >
> >
> > This is for a (dynamic) page that I have written in PHP that formats and
> > presents some query results - and the results presented vary based on
> > the user's selection of parameters on an earlier page.
> >
> >
> >
> > Any suggestions?
> >
> >
> >
> > This 'one click' menu is for users "resistant" to learning how to do
> > the
> > "File... Save Page As..." method...
> >
> >
> >
> > Thanks in advance!