Skip to content

Instantly share code, notes, and snippets.

@hdurdle
Created November 23, 2017 10:20
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hdurdle/2a93f35d19367dec37df667e0d4c738a to your computer and use it in GitHub Desktop.
Save hdurdle/2a93f35d19367dec37df667e0d4c738a to your computer and use it in GitHub Desktop.
<?php
$url = "https://hooks.slack.com/services/[Incoming-Webhook-URL]";
$msg = "Test";
parse_str($_SERVER['QUERY_STRING'], $output);
$msg = $output['message'];
$payload = 'payload={"channel": "#channel", "username": "bot-username", "text": "' . $msg . '"}';
$ch = curl_init();
curl_setopt($ch, CURLOPT_POST, TRUE);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
curl_exec($ch);
curl_close($ch);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment