summaryrefslogtreecommitdiff
path: root/app/Model/Webhook.php
diff options
context:
space:
mode:
Diffstat (limited to 'app/Model/Webhook.php')
-rw-r--r--app/Model/Webhook.php39
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);
}
}