Conditions | 3 |
Paths | 4 |
Total Lines | 33 |
Code Lines | 18 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php namespace UnderstandMonolog\Handler; |
||
12 | protected function send($requestData) |
||
13 | { |
||
14 | $endpoint = $this->getEndpoint(); |
||
15 | $ch = curl_init($endpoint); |
||
16 | |||
17 | curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST'); |
||
18 | curl_setopt($ch, CURLOPT_POSTFIELDS, $requestData); |
||
19 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); |
||
20 | curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5); |
||
21 | curl_setopt($ch, CURLOPT_TIMEOUT, 5); |
||
22 | |||
23 | if ($this->sslBundlePath) |
||
24 | { |
||
25 | curl_setopt($ch, CURLOPT_CAINFO, $this->sslBundlePath); |
||
26 | } |
||
27 | |||
28 | curl_setopt($ch, CURLOPT_USERAGENT, 'Understand Monolog'); |
||
29 | |||
30 | $response = curl_exec($ch); |
||
31 | |||
32 | if ($response === false) |
||
33 | { |
||
34 | $this->lastError = curl_error($ch); |
||
35 | } |
||
36 | else |
||
37 | { |
||
38 | $this->lastError = null; |
||
39 | } |
||
40 | |||
41 | curl_close($ch); |
||
42 | |||
43 | return $response; |
||
44 | } |
||
45 | } |