Para enviar mensajes a Discord desde PHP debemos crear un web-hook desde Discord.
Debemos ir a ajustes de nuestro servidor > Integraciones y crear el web-hook , deberemos seleccionar el nombre y el canal donde se mostraran los mensajes y copiar la URL que nos facilita.
En nuestro servidor web ( hemos usado xampp) escribimos el siguiente script PHP:
<?php
//API URL
$url = 'URL-QUE-HEMOS-COPIADO-ANTES';
//create a new cURL resource
$ch = curl_init($url);
//setup request to send json via POST
$data = array(
'content' => 'Hello DorniSoft!!'
//'embeds' => '123456'
);
$payload = json_encode($data);
print_r($payload);
//attach encoded JSON string to the POST fields
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
//set the content type to application/json
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type:application/json'));
//return response instead of outputting
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
//execute the POST request
$result = curl_exec($ch);
print $result;
//close cURL resource
curl_close($ch);
?>
Véase que la variable $data es un array con los parametros que le pasamos a Discord y el elemento ‘content’ es el mensaje que queremos enviar al canal .
Luego realizamos una petición POST a Discord enviandole el JSON y el mensaje se recibe en el canal seleccionado .
Espero que te haya gustado 😉

Hola,
Music es una comunidad para DJ y fanáticos que lo ayuda a obtener acceso completo a música electrónica exclusiva.
https://0dayflac.blogspot.com
Best Regards, James
I’m extremely inspired with your writing talents as neatly as with the structure to your blog. Is this a paid topic or did you modify it your self? Either way keep up the excellent quality writing, it’s uncommon to peer a nice blog like this one today!
I’m really impressed together with your writing talents as
smartly as with the format for your weblog. Is that this a
paid subject or did you modify it your self? Either way keep up the excellent quality
writing, it’s uncommon to peer a nice blog like this one today.
Madgicx!