-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsample_web.php
31 lines (26 loc) · 1.46 KB
/
sample_web.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
$content = isset($_POST['content']) ? $_POST['content'] : '';
$username = isset($_POST['username']) ? $_POST['username'] : '';
$avatar_url = isset($_POST['avatar_url']) ? $_POST['avatar_url'] : '';
$password = isset($_POST['password']) ? $_POST['password'] : '';
if ($password == 'MYPASSWORD')
{
// Make curl request.
$data = Array('content' => $content, 'username' => $username, 'avatar_url' => $avatar_url);
$dataJSON = json_encode($data);
$ch = curl_init('DISCORDWEBHOOKURL');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $dataJSON);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, Array
(
'Content-Type: application/json',
'Content-Length: ' . strlen($dataJSON))
);
$result = curl_exec($ch);
if ($result)
{
curl_close($ch);
}
}
?>