<html><body>
<?php

// Writing to files with w mode

$t1 = "XX XX,0,0";
$t2 = "ZZ ZZ,0,0";

@ $f = fopen('/home/abu-jeib/temp/a.txt','x');
// Try with both files that exist and files that don't exit.

if (!$f)
{
	echo "ERROR: file can't be opened.<P>\n";
	exit;
}
else
{
	 // Read two lines from the file
        echo "The first two lines are: <br>\n";
        $s = fgets($f);
        echo "$s<br>\n";
        $s = fgets($f);
        echo "$s<br>\n";

	// Write two lines
	fwrite($f,$t1."\n");
	fwrite($f,$t2."\n");
	
	fclose($f);
}

?>
</body></html>
