Last active
May 26, 2018 18:42
-
-
Save KaiserWerk/606b9a7a0781ca616596e9b7d17bc633 to your computer and use it in GitHub Desktop.
Send a message to a Discord channel
This file contains 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
<?php | |
$webhookurl = ''; | |
// You can use Markdown | |
$msg = "Testmessage [https://google.de](<URL>)"; | |
$fields = json_encode(['content' => $msg]); | |
$ch = curl_init($webhookurl); | |
curl_setopt( $ch, CURLOPT_POST, 1); | |
curl_setopt( $ch, CURLOPT_POSTFIELDS, $fields); | |
curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, 1); | |
curl_setopt( $ch, CURLOPT_HEADER, 0); | |
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1); | |
$response = curl_exec($ch); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment