Conditions | 1 |
Paths | 1 |
Total Lines | 20 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
15 | protected function sendRequest(array $data = []) |
||
16 | { |
||
17 | |||
18 | $ch = curl_init(TelegramBot::getEndpoint() . TelegramBot::getToken() . '/' . $this->method); |
||
19 | |||
20 | curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST'); |
||
21 | curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data)); |
||
22 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); |
||
23 | curl_setopt($ch, CURLOPT_HTTPHEADER, array( |
||
24 | 'Accept: application/json', 'Content-Type: application/json' |
||
25 | )); |
||
26 | |||
27 | curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); |
||
28 | curl_setopt($ch, CURLOPT_VERBOSE, false); |
||
29 | |||
30 | $response = curl_exec($ch); |
||
31 | |||
32 | curl_close($ch); |
||
33 | |||
34 | return self::validateResponse($response); |
||
35 | |||
53 | } |