Saj
05-20-2003, 05:30 PM
Can someone help me use this to pretty much open a file, parse the data and put it into a variable, change one tag of the variable, and then rewrite the file with the same information as the variable.
Here is what I have:
$postsname = "includes/posts.txt";
$postsfile = fopen($postsname, "r");
$postdata = fread($postsfile, filesize($postsname));
$new_postdata = str_replace("<!-- End of Post -->", "Replace Text<!--End of Post -->", $postdata);
fclose($postsfile);
$postsfile_write = fopen($postsname, "w");
fwrite($postsfile_write, $new_postdata);
fclose($postsfile_write);
Thanks for your help.
Here is what I have:
$postsname = "includes/posts.txt";
$postsfile = fopen($postsname, "r");
$postdata = fread($postsfile, filesize($postsname));
$new_postdata = str_replace("<!-- End of Post -->", "Replace Text<!--End of Post -->", $postdata);
fclose($postsfile);
$postsfile_write = fopen($postsname, "w");
fwrite($postsfile_write, $new_postdata);
fclose($postsfile_write);
Thanks for your help.