Re: [PHP] Re: how to send entire php webpage content to another page?

From: Bogdan Stancescu (gutza_at_moongate.ro)
Date: 11/27/03


To: php-general@lists.php.net
Date: Thu, 27 Nov 2003 16:58:10 +0200

Well, you have three solutions. One, you finish it the way you started,
in which case you'll need to use htmlspecialchars() on $out in the form
(otherwise you'll almost certainly escape from the form tag sooner or
later). Two, you store the data temporarily in a database or something
(faster for the user, they don't get to download the data twice). Three,
you re-generate this page on request. This is what I would do,
personally: I would link to the same page, only sending some parameter
(e.g. "&xls_output=true"). Then, at the beginning of the page you can
test for $xls_output and simply dump them headers in front of the whole
shebang if needed.

HTH

Bogdan

Joffrey Leevy wrote:
> Most humble apologies. Trying to create an excel file
> of the current php page which can be downloaded. What
> I've been doing is creating an output buffer and then
> using ob_get_clean to retrieve the page contents.
>
> for example, $out=ob_get_clean();
>
> Now everything works up to there, but when I try to
> post $out in a hidden form to another page it doesn't
> work.
>
>
> echo "<formaction='nextpage.php' method='post'>
> <input type='hidden' name='out' value='$out'>
> <input type='submit' value = 'save as xls file'>
> </form>\n";
>
> And on nextpage.php I have
>
> <?php
> header("Content-type: application/vnd.ms-excel");
> header("Content-Disposition: attachment;
> filename=\"test.xls\"");
> echo $out;
> ?>
>
> To make a long story short, this does not work.
> Grateful for any help.
>
>
>
> --- Bogdan Stancescu <gutza@moongate.ro> wrote:
>
>>You didn't provide much help by not answering the
>>very question in the
>>title. _HOW_ would you want to send it? Via a POST
>>variable? Internally,
>>via a plain text file? Internally, via memory
>>sharing? Via e-mail? Also,
>>it would be interesting to know what exactly you're
>>after, that could
>>help people maybe suggest some alternate methods to
>>what you're
>>currently trying. Are you trying to back up data?
>>Replicate? Synchronize?
>>
>>Bogdan
>>
>>Joffrey Leevy wrote:
>>
>>
>>>Hi:
>>>
>>>Does anyone have info on sending the contents of
>>
>>an
>>
>>>entire php webpage to another php page on the same
>>>server? A little code would be helpful.
>>>
>>>Thanks
>>>
>>>__________________________________
>>>Do you Yahoo!?
>>>Free Pop-Up Blocker - Get it now
>>>http://companion.yahoo.com/
>>
>>--
>>PHP General Mailing List (http://www.php.net/)
>>To unsubscribe, visit: http://www.php.net/unsub.php
>>
>
>
>
> __________________________________
> Do you Yahoo!?
> Free Pop-Up Blocker - Get it now
> http://companion.yahoo.com/



Relevant Pages

  • Re: For a website, are Excel scripts better than other programming
    ... Can we upload the excel file as .XLS to the website. ... So we would store the excel file on the website, but download and run the ... Advice Pro ...
    (microsoft.public.excel.programming)
  • Re: MS-Excel 2007opens .xlsm file but does not display workbook/worksh
    ... Today on one specific workbook I got macro warnings (unual as it is a ... Maybe your excel file is corrupt. ... And you can also download a free demo version at http://www.datanumen.com/aer/aer.exe ...
    (microsoft.public.office.misc)
  • Re: Media Player download to Excel
    ... download the library information to an MS Excel file. ... I am currently using Vista Home Premium and I wonder if such a tool is still ... That would have been the media info exporter for excel/word, ...
    (microsoft.public.windowsmedia.player)
  • Re: Accessing Excel data - Some columns are not coming through
    ... anyone brave enough to download it in this day and age. ... particular Excel file that does not bring data for some columns. ... You can download the problem Excel file from ... The zip file also contains the sample code to demonstrate this problem. ...
    (microsoft.public.data.oledb)