I'm trying to make a script that sends news, updates, to a Discord server, so I need to use the Webhooks system. I already mounted the whole system, everything is already working.
But the system I just sent text, and I would like to make this system to also send along with the text, two images, to get a very cool layout for the news.
In PHP I'm using the following code to send the messages to the discord:
<?php
function postToDiscord($message) {
$data = array("content" => $message, "username" => "News");
$curl = curl_init("https://discordapp.com/api/webhooks/2225546.......");
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
return curl_exec($curl);
}
?>
Only this way, it only sends text. Staying there in the discord:
ButIwantedthenewstolooklikethis:
Canyouunderstandme?Iwanttosendthesetopandfooterimagesalongwiththetext,sothenewswillappearmorebeautiful.
Forabetterunderstandingofhowthesystemworks,addtheTestServeryoucreateinthediscordandthesitethatsendsthenewstothediscord:
discord: link Posting site: link