fread fseek utf-8 file + flock?

What would be the best way to change a specific line of a utf-8 encoded text file that has a specific definition like:

.
.
"VALIDATE_RESULT":"1", 
"VERIFY_RTL":"0",
.
.
"SERVER_CRASH_MSG":"system is down",

I would like to flock, change, write and release.

I will use the code :

<?php

$fp = fopen("file.txt", "r+");

if (flock($fp, LOCK_EX)) {  // acquire an exclusive lock
    //make your changes
    fflush($fp);            // flush output before releasing the lock
    flock($fp, LOCK_UN);    // release the lock
} else {
    echo "Couldn't get the lock!";
}

fclose($fp);

?>

file_get_contents just does not cut it because it doesn't use a handle which flock requires.

Thanks