Рассмотрим пример отправки в канал discort ссылку на сайт
$url — yrl вебхука
$title — текст ссылки
$link — ссылка
$url = "https://discordapp.com/api/webhooks/666962894827606518/ro64Zlvpsh2aYB3PUtWrCMFb1RCORaO_lMzwc_mAuS-F3bnqVwDWoxflET508afHTKpZ";
$data = [
"embeds" => [
[
'title' => $title,
"url" => $link
]
]
];
$data_string = json_encode($data);
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'Content-Length: ' . strlen($data_string)
)
);
$result = curl_exec($ch);
