Dynamically saving HTML containing PHP variables through PHP

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Mitesh

    Dynamically saving HTML containing PHP variables through PHP

    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

  • Erwin Moller

    #2
    Re: Dynamically saving HTML containing PHP variables through PHP

    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

    Comment

    • P Pulkkinen

      #3
      Re: Dynamically saving HTML containing PHP variables through PHP


      "Mitesh" <oopsbabies@hot mail.comkirjoit ti
      viestissä:11709 26634.468367.31 3320@a34g2000cw b.googlegroups. 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:


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



      Comment

      Working...