· 7 years ago · Nov 29, 2018, 03:42 PM
1public function api_futebol(){
2 // CONTROLLER
3
4 $url = "https://api.betsapi.com/v1/bet365/inplay_filter?sport_id=1&token=TOKEN" . $this->refcode;
5
6 // append the header putting the secret key and hash
7
8 $request_headers = array();
9 // $request_headers[] = 'Authorization: Bearer ' . $secretKey;
10 $ch = curl_init();
11 curl_setopt($ch, CURLOPT_URL, $url);
12 curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
13 curl_setopt($ch, CURLOPT_TIMEOUT, 60);
14 curl_setopt($ch, CURLOPT_HTTPHEADER, $request_headers);
15 curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
16 $data = curl_exec($ch);
17
18 if (curl_errno($ch))
19 {
20 print "Error: " . curl_error($ch);
21 }
22 else
23 {
24 // Show me the result
25
26 $transaction = json_decode($data, TRUE);
27
28 curl_close($ch);
29
30 var_dump($transaction);
31
32 $dados = array();
33
34 $dados['transaction'] = $transaction;
35 }
36
37 $this->load->view('header');
38 $this->load->view('home', $dados);
39 $this->load->view('footer');
40 }
41
42
43//view
44
45
46
47 <?php
48
49 var_dump($transaction->results[0]->time);
50
51 ?>