<html>
<! FilePassThru.php                                           >
<! Chapter 10, Oracle Database XE PHP Web Programming         >
<! by Michael McLaughlin                                      >
<!                                                            >
<! This script declares a file pointer to hold a read-only    >
<! reference to a file and reads the entire file using the    >
<! fpassthru() function. It reads the file contents to        >
<! standard out, which can be the web page or command session >
<! console.                                                   >
<head>
<title>
  Chapter 10 : FilePassThru.php
</title>
</head>
<body>
<?php
  // Enable script to run at command-line.
  if (@$_SERVER["argv"])
    for ($i = 1;$i < $_SERVER["argc"];$i++)
      print "Argument [".($i - 1)."]\t[".$_SERVER["argv"][$i]."]\n";

  // Declare a file name when no parameters are provided..
  if (count($_GET) == 0)
    $fn= "RedRabbit.htm";

  // Declare a read-only file pointer to a file in the local directory.
  $fp = fopen($fn,"r");

  // Read the file contents into standard out.
  fpassthru($fp);

  // Close the open file handle.
  fclose($fp);
?>
</body>
</html>