| Conditions | 1 |
| Paths | 1 |
| Total Lines | 22 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 15 | public function curl($ip) |
||
| 16 | { |
||
| 17 | |||
| 18 | |||
| 19 | $access_key = "5f23ea8bea3969482c26bb6b2d8249bf"; |
||
| 20 | |||
| 21 | $url = 'http://api.ipstack.com/'.$ip.'?access_key='.$access_key.''; |
||
| 22 | |||
| 23 | |||
| 24 | // Initialize CURL request: |
||
| 25 | $ch = curl_init($url); |
||
| 26 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); |
||
|
|
|||
| 27 | |||
| 28 | |||
| 29 | // Store the data in a var: |
||
| 30 | $json = curl_exec($ch); |
||
| 31 | curl_close($ch); |
||
| 32 | |||
| 33 | |||
| 34 | // Decode the JSON response: |
||
| 35 | $api_result = json_decode($json, true); |
||
| 36 | return $api_result; |
||
| 37 | } |
||
| 39 |