mirror of
https://github.com/Seldaek/monolog.git
synced 2025-08-06 21:26:43 +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);
|
||||
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, $this->webhookUrl);
|
||||
curl_setopt($ch, CURLOPT_POST, true);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
$options = [
|
||||
CURLOPT_URL => $this->webhookUrl,
|
||||
CURLOPT_POST => true,
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
CURLOPT_HTTPHEADER => ['Content-type: application/json'],
|
||||
CURLOPT_POSTFIELDS => $postString
|
||||
];
|
||||
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);
|
||||
}
|
||||
|
Reference in New Issue
Block a user