By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,718 Members | 1,461 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,718 IT Pros & Developers. It's quick & easy.

Dynamically saving HTML containing PHP variables through PHP

P: n/a
I have an HTML page with references to PHP variables. This HTML is
included from another PHP page. How can I save the HTML page
dynamically i.e. when all the PHP variables are written into the HTML
page.

Thanx in Advance

Feb 8 '07 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Mitesh wrote:
I have an HTML page with references to PHP variables. This HTML is
included from another PHP page. How can I save the HTML page
dynamically i.e. when all the PHP variables are written into the HTML
page.

Thanx in Advance
Hi,

Probably the easiest way:
When creating the file that contains the values of PHP:

1) start outputbuffering above your page: ob_start()
2) Just output all you want, using your PHP variables to produce the output
3) At the end of the script, get the content of the buffer, and write that
to the file you want to include elsewhere.

If you have to do this for many pages (eg: all is dynamic), and have to
automate the process: have a look at CURL. Curl can call another PHP script
with POST or GET parameters given by you (eg the filename, other vars that
are used to produce the output, etc)

Hope that helps

Regards,
Erwin Moller
Feb 8 '07 #2

P: n/a

"Mitesh" <oo********@hotmail.comkirjoitti
viestissä:11**********************@a34g2000cwb.goo glegroups.com...
>I have an HTML page with references to PHP variables. This HTML is
included from another PHP page. How can I save the HTML page
dynamically i.e. when all the PHP variables are written into the HTML
page.
Do You mean that you want to "store" the whole html-output of your script
into another file?

Use output buffering:
http://www.php.net/manual/en/ref.outcontrol.php

Buffer everything, then copy the whole buffer to a file and then send actual
page(buffer content) to client.

Feb 8 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.