I am trying to write to an xml file. All have same ending.
<gallery id="1">
<img src=blabla>
</gallery>
<gallery id="2">
<img src=blabla>
</gallery>
<gallery id="3">
<img src=blabla>
</gallery>
when I do
fread(fopen("file.xml", "r"), 100000);
$start= strpos($fd,"<gallery id=\"2\">";
I get the pointer position. Now I need to get the corresponding </galley>
when I do
$finish=strpos($fd,"</gallery>");
of course, it picks up the </gallery> from above because the cursor starts at 0 again.
How can I tell $finish to start looking for "</gallery>" from $start and to write in that space? This is the one I need to replace by writing over it.
Thanks.