#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2012
    Posts
    6
    Rep Power
    0

    Processing the php page then output a .html file


    I got this data entry into an html template job. I basically update their product pages with new text an images.

    So instead of going through the html code and I wrote some php that would just change all the image links etc.

    Their site doesn't support php. So I wanted php to generate the html which i got.

    I could view source and copy that html and paste it in an html. But i was hoping to be even more lazy and find out how can I make php write a document of the document after it has been processed.

    Does this make sense? So I can upload that .html onto the server.

    Thanks so much!
  2. #2
  3. --
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Jul 2012
    Posts
    3,957
    Rep Power
    1046
    Hi,

    you can use PHP's output buffer to collect the HTML markup and write it to a file:
    PHP Code:
    <?php ob_start();    // start the output buffering ?>

    <b>Your document</b>

    <?php file_put_contents'C:/htdocs/phpout.txt'ob_get_contents() );    // fetch the buffer content and write it to a file
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2012
    Posts
    6
    Rep Power
    0
    That totally worked. You are a god!!! Thank you so much.
  6. #4
  7. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2012
    Posts
    6
    Rep Power
    0
    Originally Posted by Jacques1
    Hi,

    you can use PHP's output buffer to collect the HTML markup and write it to a file:
    PHP Code:
    <?php ob_start();    // start the output buffering ?>

    <b>Your document</b>

    <?php file_put_contents'C:/htdocs/phpout.txt'ob_get_contents() );    // fetch the buffer content and write it to a file
    I have a follow up question with this process I want php to also change all trademark R (r) to <sup>(r)</sup

IMN logo majestic logo threadwatch logo seochat tools logo