Skip to content

Instantly share code, notes, and snippets.

@KaiserWerk
Last active May 26, 2018 18:42
Show Gist options
  • Save KaiserWerk/606b9a7a0781ca616596e9b7d17bc633 to your computer and use it in GitHub Desktop.
Save KaiserWerk/606b9a7a0781ca616596e9b7d17bc633 to your computer and use it in GitHub Desktop.
Send a message to a Discord channel
<?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