View Single Post
  #1 (permalink)  
Old 2003-10-27, 04:56 PM
Pablo
Guest
 
Posts: n/a
Default

Hi. I have a problem modifying a .htm file. I want append a lines to this file, but my code overwrite the following line, I send the code of the problem. Is importan say that is not possible append to the end of file, only in this place of the file.....
<?PHP
$file = fopen ("05ins02s.htm", "r+b");
if (!$file) {
echo "

No puede abrir archivo $file.\n";
exit;
}
while (!feof ($file)) {
$line = fgets ($file, 1024);
if (eregi ("head", $line, $out)) {
fwrite($file, "SOY PCM");
break;
}
}
fclose($file);
# more 05ins02s.htm (this file is the original)
<!DOCTYPE HTML PUBLIC "-//W3C//DTD
0/strict.dtd">
<HTML LANG=sp>
<HEAD>
<TITLE>Particiones</TITLE>
---------------------&&&&&&&&-------
# more 05ins02s.htm (this result with my code), here i want that append (SOY PCM) and overwrite !!!! (help me)...
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http:
0/strict.dtd">
<HTML LANG=sp>
<HEAD>
SOY PCM>Particiones</TITLE>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html">
end....
Reply With Quote