<?php
function discordNotify(string $webhookUrl, string $title, string $description, int $color = 0x36a64f): bool {
$payload = ['embeds' => [[
'title' => $title,
'description' => $description,
'color' => $color, // decimal int, e.g. 0xFF0000 for red
'timestamp' => date('c'),
]]];
$ch = curl_init($webhookUrl);
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => json_encode($payload),
CURLOPT_HTTPHEADER => ['Content-Type: application/json'],
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 5,
]);
curl_exec($ch);
$code = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);
curl_close($ch);
return $code === 204; // Discord returns 204 on success
}
discordNotify('https://discord.com/api/webhooks/...', 'Deploy succeeded', 'v2.3.1 is live', 0x10B981);
Create a free account and build your private vault. Share publicly whenever you want.