Conditions | 2 |
Paths | 2 |
Total Lines | 31 |
Code Lines | 21 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
22 | public function handle() |
||
23 | { |
||
24 | $curl = curl_init(); |
||
25 | |||
26 | curl_setopt_array($curl, [ |
||
27 | CURLOPT_URL => "https://api.sparkpost.com/api/v1/transmissions", |
||
28 | CURLOPT_RETURNTRANSFER => true, |
||
29 | CURLOPT_ENCODING => "", |
||
30 | CURLOPT_MAXREDIRS => 10, |
||
31 | CURLOPT_TIMEOUT => 30, |
||
32 | CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, |
||
33 | CURLOPT_CUSTOMREQUEST => "POST", |
||
34 | CURLOPT_POSTFIELDS => json_encode($this->postFields), |
||
35 | CURLOPT_HTTPHEADER => [ |
||
36 | "accept: application/json", |
||
37 | "authorization: " . config('sparkify.sparkpost_api_key'), |
||
38 | "cache-control: no-cache", |
||
39 | "content-type: application/json" |
||
40 | ] |
||
41 | ]); |
||
42 | |||
43 | curl_exec($curl); |
||
44 | |||
45 | $error = curl_error($curl); |
||
46 | |||
47 | curl_close($curl); |
||
48 | |||
49 | if ($error) { |
||
50 | Log::error("cURL Error: " . $error); |
||
51 | } |
||
52 | } |
||
53 | } |
||
54 |