# must replace the URL with the actual hook URL with proper token on it
$ch = curl_init('https://chat.url.example/hooks/token');
# its easier doing it this way because then json_encode
# will take care of escaping or whatever else it needs to do
$payload = [
'username' => "BOT",
'text' => "some message test!"
];
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, 'payload=' . json_encode($payload));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_HEADER, 1);
$result = curl_exec($ch);
curl_close($ch);
return $result;
Its what I use for some stuff and works just fine for me, you only need to define the channel in the payload if u want to send it to a different channel then the one u have set your hook to.