Created
May 14, 2020 18:44
-
-
Save trentwiles/d2d57c382531a5f04f4489bb2e011c6d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$url = "https://discord.com/api/webhooks/yourwebhookhere"; | |
$hookObject = json_encode([ | |
/* | |
* The general "message" shown above your embeds | |
*/ | |
"content" => "A message from a person named **". $_POST['name'] . "** with the email **" . $_POST['email'] . "** and the discord **" . $_POST['discord'] . "** has been sent. This is the message: **" . $_POST['text'] . "**", | |
/* | |
* The username shown in the message | |
*/ | |
"username" => "Tucker's Clone", | |
/* | |
* The image location for the senders image | |
*/ | |
"avatar_url" => "https://cdn.glitch.com/fd60a947-0fe1-4133-9a8a-a275c2983a30%2FScreenshot%202020-04-09%20at%202.34.00%20PM.png?v=1589475403343", | |
/* | |
* Whether or not to read the message in Text-to-speech | |
*/ | |
"tts" => false, | |
]); | |
$ch = curl_init(); | |
curl_setopt_array( $ch, [ | |
CURLOPT_URL => $url, | |
CURLOPT_POST => true, | |
CURLOPT_POSTFIELDS => $hookObject, | |
CURLOPT_HTTPHEADER => [ | |
"Content-Type: application/json" | |
] | |
]); | |
$response = curl_exec( $ch ); | |
curl_close( $ch ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment