Discussion:
Output to File Instead of Browser
Floyd Resler
2013-08-20 16:38:45 UTC
Permalink
I have a php file that generates a form. Of course, this displays in the browser. How can I have the form generated from my script but either saved to a file or the output returned to another script?

Thanks!
Floyd
Bastien
2013-08-20 18:17:07 UTC
Permalink
Post by Floyd Resler
I have a php file that generates a form. Of course, this displays in the browser. How can I have the form generated from my script but either saved to a file or the output returned to another script?
Thanks!
Floyd
I guess it depends on how your code is structured. I have older coder where the HTML is all one string so a file_put_contents($html, $filename); works simply.



Bastien Koert
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Serge Fonville
2013-08-20 18:24:06 UTC
Permalink
Post by Floyd Resler
How can I have the form generated from my script but either saved to a
file or the output returned to another script?
if you just want to output the generated output of the script to a file you
can use output buffering http://www.php.net/manual/en/book.outcontrol.php

HTH

Kind regards/met vriendelijke groet,

Serge Fonville

http://www.sergefonville.nl

Convince Microsoft!
They need to add TRUNCATE PARTITION in SQL Server
https://connect.microsoft.com/SQLServer/feedback/details/417926/truncate-partition-of-partitioned-table
Post by Floyd Resler
Post by Floyd Resler
I have a php file that generates a form. Of course, this displays in
the browser. How can I have the form generated from my script but either
saved to a file or the output returned to another script?
Post by Floyd Resler
Thanks!
Floyd
I guess it depends on how your code is structured. I have older coder
where the HTML is all one string so a file_put_contents($html, $filename);
works simply.
Bastien Koert
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Jim Giner
2013-08-20 18:25:21 UTC
Permalink
Post by Floyd Resler
I have a php file that generates a form. Of course, this displays in the browser. How can I have the form generated from my script but either saved to a file or the output returned to another script?
Thanks!
Floyd
Store your generated web page (from !<doctype to </html>) in a variable.
Then either use file_put_contents or save the var to a session one and
call the next script.

That's what I would do, if I ever found myself needing to do
such a thing.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Daniel Pöllmann
2013-08-20 19:20:39 UTC
Permalink
Buffering is the more comftable way because if you write all html to a
variable, output that might be created in a function, you did not modify
will not be included.

Non critical errors that create an output (notice/warning) will not ve
included as well.

Another way would be to create a script which makes a http request to the
output script and saves the response to the file

Daniel
Post by Floyd Resler
I have a php file that generates a form. Of course, this displays in the
browser. How can I have the form generated from my script but either saved
to a file or the output returned to another script?
Thanks!
Floyd
Jim Giner
2013-08-20 19:31:41 UTC
Permalink
Post by Daniel Pöllmann
Buffering is the more comftable way because if you write all html to a
variable, output that might be created in a function, you did not modify
will not be included.
Non critical errors that create an output (notice/warning) will not ve
included as well.
Another way would be to create a script which makes a http request to the
output script and saves the response to the file
Daniel
Post by Floyd Resler
I have a php file that generates a form. Of course, this displays in the
browser. How can I have the form generated from my script but either saved
to a file or the output returned to another script?
Thanks!
Floyd
I assumed that the user would only be doing this once it had been
debugged.
Don't understand why a function generating output would present a problem.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Loading...