info343/lectures/intro-to-ajax/files/quote.phps

<?php
   // quote.php
   // Outputs a single random quote in text/plain.
   // INFO 343, Autumn 2012
   // Morgan Doocy
   // (Originally from CSE 190 M, Marty Stepp)
   
   // Uncomment to cause the server to take artificailly long to respond to request:
   // sleep(4);
   
   $text = file_get_contents("quotes.txt");
   $quotes = preg_split("/\r?\n\r?\n/", $text);
   header("Content-type: text/plain");
?>
<?= $quotes[array_rand($quotes)] ?>