Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $discord_token = $_POST["discord_token"];
- $text = $_POST["text"];
- $name = $_POST["name"];
- $json_data = json_encode([
- "content" => $text,
- "username" => $name,
- ], JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE );
- $ch = curl_init( $discord_token );
- 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 );
Add Comment
Please, Sign In to add comment