Guest User

Simple get-text-file

a guest
Jul 12th, 2014
328
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.33 KB | None | 0 0
  1. if(isset($_GET['q'])) {
  2.     $query = $_GET['q'];
  3. } else {
  4.     echo 'Please set Query ID';
  5.     exit;
  6. }
  7.  
  8. if(is_file('text_files/' . $query . '.txt')) {
  9.     $text_file = file_get_contents('text_files/' . $query . '.txt');
  10. } else {
  11.     echo 'No such ID!';
  12.     exit;
  13. }
  14.  
  15. var_dump($text_file);
  16.  
  17. echo 'Successfully retrieved text file!';
  18. exit;
Advertisement
Add Comment
Please, Sign In to add comment