Jump to content

[SOLVED] Publish page source using PHP


The_Grinch

Recommended Posts

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

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.