mirror of
https://github.com/Seldaek/monolog.git
synced 2025-08-09 14:46:46 +02:00
SlackWebhookHandler: refactor curl_setopt to curl_setopt_array
This commit is contained in:
committed by
Jordi Boggiano
parent
52d9096b14
commit
4260b46760
@@ -81,14 +81,18 @@ class SlackWebhookHandler extends AbstractProcessingHandler
|
|||||||
$postString = json_encode($postData);
|
$postString = json_encode($postData);
|
||||||
|
|
||||||
$ch = curl_init();
|
$ch = curl_init();
|
||||||
curl_setopt($ch, CURLOPT_URL, $this->webhookUrl);
|
$options = [
|
||||||
curl_setopt($ch, CURLOPT_POST, true);
|
CURLOPT_URL => $this->webhookUrl,
|
||||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
CURLOPT_POST => true,
|
||||||
|
CURLOPT_RETURNTRANSFER => true,
|
||||||
|
CURLOPT_HTTPHEADER => ['Content-type: application/json'],
|
||||||
|
CURLOPT_POSTFIELDS => $postString
|
||||||
|
];
|
||||||
if (defined('CURLOPT_SAFE_UPLOAD')) {
|
if (defined('CURLOPT_SAFE_UPLOAD')) {
|
||||||
curl_setopt($ch, CURLOPT_SAFE_UPLOAD, true);
|
$options[CURLOPT_SAFE_UPLOAD] = true;
|
||||||
}
|
}
|
||||||
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-type: application/json']);
|
|
||||||
curl_setopt($ch, CURLOPT_POSTFIELDS, $postString);
|
curl_setopt_array($ch, $options);
|
||||||
|
|
||||||
Curl\Util::execute($ch);
|
Curl\Util::execute($ch);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user