You can use
fread () when you want to read the file data and return it to a string. You can specify how many bytes to read, but 8192 is the maximum. If you choose to use this method, you must be sure to
open the file first.
<?php
$YourFile = "YourFile.txt";
$handle = fopen($YourFile, 'r');
$Data = fread($handle, 512);
fclose($handle);
print $Data;
?>
This code opens the file YourFile.txt from your server and puts it's entire contents into the variable $Data as a string. We then print $Data, so the script is basically outputting the file contents onto a page.