Forum Moderators: coopster

Message Too Old, No Replies

Editing files

Help please

         

Zenden

5:26 pm on Apr 27, 2005 (gmt 0)

10+ Year Member



Hello, i am trying to make a script that would replace a code in a xml file.

what the code would do is

find "a piece of the code in the xml"(in my case, premdays="0), erase it and write "another piexe of code"(in my case premdays="1". in the same place, some can help on that?

ncreegan

5:30 pm on Apr 27, 2005 (gmt 0)

10+ Year Member



$newtext=str_replace("oldprase", "newphrase", "$oldtext");

searches string oldtext for oldphrase and changes it to newphrase

then something to the effect of

$fp=fopen("output.xml", "w+");
fwrite($fp, $newtext);

your permissions will probably have to be changed if you haven't done that yet