| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- <?php
- //// Facebook verification
- //if ($_SERVER['REQUEST_METHOD'] === 'GET') {
- // $verify_token = 'EAAJB2BlGxRMBO62lsPzKpIZA0ZAojmgqubtBdTX6WJpFoDeISffzlcObVG1y0o9J2sGcYPOPfaG0mhSGKHSDFY67njunqRQIL3YMsNE8xC5NDQ2TgKdjfib6tjhfVT0Tg8XMKt7yvN9NP3GQek3i4oB3AXl5dX5bBuFfhZB0YbHgXJbNohMXHZCHRBCSw1PmsECK3j3BjxZCoRiV7PGwuoKFCFc3M5UiRjiUqaZBsT';
- // if ($_GET['hub_verify_token'] === $verify_token) {
- // echo $_GET['hub_challenge'];
- // exit;
- // } else {
- // http_response_code(403);
- // exit;
- // }
- //}
- //
- //
- //// Receive Message from WhatsApp
- //if ($_SERVER['REQUEST_METHOD'] === 'POST') {
- // $input = json_decode(file_get_contents('php://input'), true);
- // $message = $input['entry'][0]['changes'][0]['value']['messages'][0]['text']['body'];
- // $from = $input['entry'][0]['changes'][0]['value']['messages'][0]['from'];
- //
- // $token = 'EAAJB2BlGxRMBOZBj1DZArQo02p6hqxEluzCzbSvNvlNs7fBtb2tv57KZAflNUte6j9ip37ZCXmUVXZBZCtp44Sb93Gb83dh2ZAEBZA3ZCbzAlwl47CPtjkWi0pEIE5f1Fi1hkZCWcyXs6ZBQVzZBicCcOZBNStGMHOCwQZCmLqMT5U9Juv7L0eQbvTUB6clwtFnvZBmJA2ZASgPymjBC04odbwCiP5TSzNZBG3iZAs6ULecUkZD';
- // $phone_id = '706930449163857';
- //
- // $url = "https://graph.facebook.com/v19.0/$phone_id/messages";
- //
- // $msg_encoded = urlencode($message);
- // $bot_url = "https://agent.cybob.com/awigo/?controller=message&message=$msg_encoded";
- //
- // $ch2 = curl_init($bot_url);
- // curl_setopt($ch2, CURLOPT_RETURNTRANSFER, true);
- // curl_setopt($ch2, CURLOPT_ENCODING, '');
- // curl_setopt($ch2, CURLOPT_FOLLOWLOCATION, true);
- // $bot_response = curl_exec($ch2);
- // $curl_error = curl_error($ch2);
- // curl_close($ch2);
- //
- // $bot_data = json_decode($bot_response, true);
- //
- // if (isset($bot_data['reply'])) {
- // $reply = $bot_data['reply'];
- // $reply = strip_tags(html_entity_decode($reply));
- // } else {
- // $reply = "Botfehler:\nAntwort: $bot_response\nFehler: $curl_error";
- // }
- //
- // $payload = [
- // "messaging_product" => "whatsapp",
- // "to" => $from,
- // "type" => "text",
- // "text" => ["body" => $reply]
- // ];
- //
- // $ch = curl_init($url);
- // curl_setopt($ch, CURLOPT_HTTPHEADER, [
- // "Authorization: Bearer $token",
- // "Content-Type: application/json"
- // ]);
- // curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));
- // curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
- // curl_exec($ch);
- // curl_close($ch);
- //
- // echo json_encode(["status" => "ok"]);
- // exit;
- //}
- //?>
|