Created
January 20, 2017 16:58
-
-
Save Crowles/8fe5b8399b90125eac63119dfa1e5d15 to your computer and use it in GitHub Desktop.
Slack Webhook Integration
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
return slack(); | |
function slack() { | |
$data = []; | |
// You can get your webhook endpoint from your Slack settings | |
$ch = curl_init(""); | |
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); | |
curl_setopt($ch, CURLOPT_POSTFIELDS, array('payload' => $data)); | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); | |
$result = curl_exec($ch); | |
curl_close($ch); | |
return $result; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment