diff options
| author | Frederic Guillot <fred@kanboard.net> | 2015-03-28 21:37:53 -0400 |
|---|---|---|
| committer | Frederic Guillot <fred@kanboard.net> | 2015-03-28 21:37:53 -0400 |
| commit | 5536f6c6ce591ba05a169d2e33b6fb240378d8a4 (patch) | |
| tree | bac0cb1563d8258965384b97be8d425578f71ef6 /app/Model/Webhook.php | |
| parent | f9891a966fb87d2112f174b7c3a1b3a705b73bdd (diff) | |
Add Slack integration
Diffstat (limited to 'app/Model/Webhook.php')
| -rw-r--r-- | app/Model/Webhook.php | 39 |
1 files changed, 1 insertions, 38 deletions
diff --git a/app/Model/Webhook.php b/app/Model/Webhook.php index 7edffa6e..b3603818 100644 --- a/app/Model/Webhook.php +++ b/app/Model/Webhook.php @@ -11,27 +11,6 @@ namespace Model; class Webhook extends Base { /** - * HTTP connection timeout in seconds - * - * @var integer - */ - const HTTP_TIMEOUT = 1; - - /** - * Number of maximum redirections for the HTTP client - * - * @var integer - */ - const HTTP_MAX_REDIRECTS = 3; - - /** - * HTTP client user agent - * - * @var string - */ - const HTTP_USER_AGENT = 'Kanboard Webhook'; - - /** * Call the external URL * * @access public @@ -42,22 +21,6 @@ class Webhook extends Base { $token = $this->config->get('webhook_token'); - $headers = array( - 'Connection: close', - 'User-Agent: '.self::HTTP_USER_AGENT, - ); - - $context = stream_context_create(array( - 'http' => array( - 'method' => 'POST', - 'protocol_version' => 1.1, - 'timeout' => self::HTTP_TIMEOUT, - 'max_redirects' => self::HTTP_MAX_REDIRECTS, - 'header' => implode("\r\n", $headers), - 'content' => json_encode($task) - ) - )); - if (strpos($url, '?') !== false) { $url .= '&token='.$token; } @@ -65,6 +28,6 @@ class Webhook extends Base $url .= '?token='.$token; } - @file_get_contents($url, false, $context); + return $this->httpClient->post($url, $task); } } |
