The_Grinch Posted August 20, 2008 Share Posted August 20, 2008 Hi All, I have a simple PHP script that allows the user to upload a file using an HTML form, upon clicking submit the PHP script uploads the file to my server, applys some HTML to it and displays it. I then want a link on my server i can send out that displays the formatted file (I cant send the .php link as the script is reset). Ideally i just want to copy the HTML page sorce of the output, host that on my sever as regular HTML, and send out the URL. Any help appreciated. Thanks The Grinch (PHP newb) Link to comment https://forums.phpfreaks.com/topic/120503-solved-publish-page-source-using-php/ Share on other sites More sharing options...
captbaritone Posted August 20, 2008 Share Posted August 20, 2008 How about this: Instead of echoing or printing the output of your php script as you go though it, append each new output to a single variable: echo $htmlLine; becomes $output .= $htmlLine; Then before you output it, write the contents of $output to an html file, and then: echo $output; Is that what you were trying to do? -Captbaritone Link to comment https://forums.phpfreaks.com/topic/120503-solved-publish-page-source-using-php/#findComment-620948 Share on other sites More sharing options...
stevesimo Posted August 20, 2008 Share Posted August 20, 2008 here is the php code ya will need to save the code to a file on your server $output = 'User input will be in this value'; //save webpage to server $webpage = fopen('filename.htm',"w"); fwrite($webpage,$output); fclose($webpage); hope this helps Link to comment https://forums.phpfreaks.com/topic/120503-solved-publish-page-source-using-php/#findComment-620949 Share on other sites More sharing options...
The_Grinch Posted August 20, 2008 Author Share Posted August 20, 2008 Chaps, thanks for these suggestions - I'll give them a shot. CHEERS The Grinch Link to comment https://forums.phpfreaks.com/topic/120503-solved-publish-page-source-using-php/#findComment-620954 Share on other sites More sharing options...
The_Grinch Posted August 20, 2008 Author Share Posted August 20, 2008 TOPIC SOLVED Guys, the 2nd approach seems to work best with my setup. Thanks very much for all the help! Thanks The Grinch Link to comment https://forums.phpfreaks.com/topic/120503-solved-publish-page-source-using-php/#findComment-620973 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.