kyroskoh

Twitch CustomAPI - 8Ball

May 7th, 2016
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.27 KB | None | 0 0
  1. <?php
  2. // An array with the traditional old and new answers.
  3. $Answers = array
  4. (
  5.     "It is certain!",
  6.     "It is decidedly so!",
  7.     "Without a doubt!",
  8.     "Yes, definitely!",
  9.     "You may rely on it!",
  10.     "As I see it, yes!",
  11.     "Most likely!",
  12.     "Outlook good!",
  13.     "Yes!",
  14.     "Signs point to yes!",
  15.     "Reply hazy try again.",
  16.     "Ask again later.",
  17.     "Better not tell you now.",
  18.     "Cannot predict now.",
  19.     "Concentrate and ask again.",
  20.     "Don't count on it.",
  21.     "My reply is no.",
  22.     "My sources say no.",
  23.     "Outlook not so good.",
  24.     "Very doubtful.",
  25.     "Yes, in due time.",
  26.     "My sources say no.",
  27.     "Definitely not.",
  28.     "You will have to wait.",
  29.     "I have my doubts.",
  30.     "Outlook so so.",
  31.     "Looks good to me!",
  32.     "Who knows?",
  33.     "Looking good!",
  34.     "Probably.",
  35.     "Are you kidding?",
  36.     "Go for it!",
  37.     "Don't bet on it.",
  38.     "Forget about it."
  39. );
  40. // Count the array, generate random number from 0-(max array size) faster than array_rand().
  41. $Answer = $Answers[mt_rand(0, count($Answers) - 1)];
  42. // Display the original question with who asked, and answer.
  43. echo htmlspecialchars($_GET["From"]) . ' asks "' . htmlspecialchars($_GET["GeneralQuery"]) . '"  Magic Eight Ball says: ' . $Answer;
  44. ?>
  45.  
  46. Example: Magic8Ball.php?From=Myself&GeneralQuery=Should everyone release their APIs for an open community?
Add Comment
Please, Sign In to add comment