Hey all,
i’m trying to update a html page from php which pulls variables from flash which all works fine and does update…BUT all my html code is missing and not showing…so i have tried to capture the htmldata(code) from the file and write to the same file as its updated so that it will hopefully update and have html styles to.
here is the code: (it currently doesn’t work but the basic fwrite etc updates fine)
<?php
$filename = $_POST["filename"];
$theText = $_POST["theText"];
$theText = ($theText);
$url = "http://www.myURL.com";
$sourcepage = "$url/images/folder/monthly_newsletter.php";
$dynamic_source = fopen($sourcepage, 'r');
if (!$dynamic_source) {
echo "<strong>Unable to load $sourcepage
- Static page! Update Failed!</strong>";
exit();
}
$htmldata = fread($dynamic_source, 1024*1024);
fclose($dynamic_source);
$filename = fopen($sourcepage, 'w');
$data = fopen($filename, "w");
fwrite($data,$theText,$htmldata);
fclose($data);
echo "File created or updated";
?>
any help would be great
Cheers Peeps