Slack notification via CURL

$data = 'payload=' . json_encode(array( 'channel' => '#channel-name', 'text' => 'Testing a happy message', 'icon_emoji' => ':smiley:' //"icon_emoji" => ':anguished:' )); $ch = curl_init('https://hooks.slack.com/services/TOKENHERE');// webhook endpoint for Slack curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST'); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $result = curl_exec($ch); curl_close($ch);

1 Response

hello

Write a comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.