1 | <?php |
||
13 | class ApiCallService |
||
14 | { |
||
15 | |||
16 | private $url = 'https://api.onpage.org/zoom/json'; |
||
17 | |||
18 | /** |
||
19 | * Start the api call |
||
20 | * |
||
21 | * @param string $json |
||
22 | * |
||
23 | * @return string |
||
24 | */ |
||
25 | public function makeCall($json) |
||
26 | { |
||
27 | try { |
||
28 | $this->checkForCurl(); |
||
29 | |||
30 | return $this->send($json); |
||
31 | } catch (UnavailableException $e) { |
||
|
|||
32 | } |
||
33 | } |
||
34 | |||
35 | /** |
||
36 | * Check if curl is loaded |
||
37 | * |
||
38 | * @throws \Exception |
||
39 | */ |
||
40 | protected function checkForCurl() |
||
46 | |||
47 | /** |
||
48 | * Send the api request |
||
49 | * |
||
50 | * @param string $data |
||
51 | * |
||
52 | * @return string |
||
53 | * @throws UnavailableException |
||
54 | */ |
||
55 | protected function send($data) |
||
80 | } |
||
81 |