-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
31 lines (26 loc) · 954 Bytes
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<?php
file_put_contents("fb_msg.txt", file_get_contents("php://input"));
$fb = file_get_contents("fb_msg.txt");
$fb = json_decode($fb);
$rid = $fb -> entry[0] ->messaging[0]-> sender-> id;
$token = "EAABpayZBvDXgBACMPV9KFmiqnAlZC0rH1nk7jkQ2iSZC2FgywCBmBbkjSgijdaroxmzPcJ472oWE6BqF0hzJRahNKkxpy5MR6nb6mreDObqioYv8eyWZBfjZAhEshUxK76tYBaw5Hii7n7s7lDWRUWuwjLhotwZBXrJtIZAGuUKXgZDZD";
$replies = array(
"Hi Nice to meet you!",
"How are you?",
"Hope you enjoyed this!",
"Like if you enjoyed this!"
"Enjoy the BOT!:-)"
);
$data = array(
'recipient' => array('id' => "$rid"),
'message' => array('text' => replies[rand(0,4)])
);
$options = array(
'http' => array(
'method' => 'POST',
'content' => json_encode($data),
'header' => "Content-Type: application/json\n"
)
);
$context = stream_context_create($options);
file_get_contents("https://graph.facebook.com/v2.6/me/messages?access_token=$token");