I tried that but it gives me error messages as shown below with the code that I tried:
PHP Code:
<?php
$file = "test.txt";
function CheckBloc ($bloc, $stream,$replace,$pos)
{
$pos_bloc = 0;
while ($pos_bloc = strpos($stream,$bloc,$pos_bloc))
{
$pos_bloc = $pos_bloc + $pos;
$stream = substr($stream,$replace,$pos_bloc,8);
}
return $stream;
}
$text=fopen($file,'r') or die("File missing" );
//$content=file_get_contents($file);
$content = file($file);
$content_new = CheckBloc('{AB',$content,'uuuuuuuu',6);
$content_new = CheckBloc('{CD:',$content_new,'uuuuuuuu',4);
fclose($text);
$text2=fopen($file,'w+') or die("File missing" );
fwrite($text2,$content_new);
fclose($text2);
?>
Warning: strpos() expects parameter 1 to be string, array given in D:\PRIV\EasyPHP5.3.0\www\test.php on line 7
Warning: strpos() expects parameter 1 to be string, array given in D:\PRIV\EasyPHP5.3.0\www\test.php on line 7
Warning: fwrite() expects parameter 2 to be string, array given in D:\PRIV\EasyPHP5.3.0\www\test.php on line 25
Bookmarks