<?php
/*Created by MmuoDev.
*/
require_once 'classes/botClass.php';
require_once 'classes/constants.php';
if (isset($_GET['hub_verify_token'])) {
if ($_GET['hub_verify_token'] === VERIFY_TOKEN) { //Token entered during setup. It is defined as a constant in constants.php
echo $_GET['hub_challenge'];
return;
} else {
echo 'Invalid Verify Token';
return;
}
}
$accessToken = ACCESS_TOKEN; //Access token generated by Facebook. It is defined as a constant in constants.php.
$bot = new botClass(); //Initialize an object of the bot class
$input = json_decode(file_get_contents('php://input'), true); //JSON decode messages received
$bot->setAccessToken($accessToken);
$message = $bot->readMessage($input); //Call the method that reads messages
$bot->sendMessage($message); //Call the method that sends messages
|