-
Notifications
You must be signed in to change notification settings - Fork 14
/
form.php
27 lines (25 loc) · 885 Bytes
/
form.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
<?php
header("Access-Control-Allow-Origin: *");
if (isset($_GET['text']) AND isset($_GET['id']) AND isset($_GET['token'])) {
$text=$_GET['text'];
$id=$_GET['id'];
$token=$_GET['token'];
$webhookurl= "https://discordapp.com/api/webhooks/$id/$token";
$json_data = json_encode([
// Message
"content" => "$text"
], JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE );
$ch = curl_init( $webhookurl );
curl_setopt( $ch, CURLOPT_HTTPHEADER, array('Content-type: application/json'));
curl_setopt( $ch, CURLOPT_POST, 1);
curl_setopt( $ch, CURLOPT_POSTFIELDS, $json_data);
curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt( $ch, CURLOPT_HEADER, 0);
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec( $ch );
curl_close( $ch );
echo "Sukses mengirim pesan ke discord";
} else {
echo "VARIABLE BELUM DISET";
}
?>