| Conditions | 1 |
| Paths | 1 |
| Total Lines | 24 |
| Code Lines | 5 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 6 |
| CRAP Score | 1 |
| Changes | 0 | ||
| 1 | <?php |
||
| 10 | 4 | public function validateipActionGet($ipAdress = null, $accessKey = null) : string |
|
| 11 | { |
||
| 12 | |||
| 13 | // $url = "apikey.json"; |
||
| 14 | // $data = file_get_contents("http://" . $_SERVER["HTTP_HOST"] . "/dbwebb/ramverk1/me/redovisa/src/IpValidators/apikey.json"); |
||
| 15 | // $keytest = json_decode($data); |
||
| 16 | // |
||
| 17 | // |
||
| 18 | // $accessKey = $keytest->api_key; |
||
| 19 | // echo $accessKey; |
||
| 20 | |||
| 21 | |||
| 22 | // http://api.ipstack.com/79.138.27.9?access_key=ae68fdd7e0843f6cbbaf81475db34e24 |
||
| 23 | 4 | $curlh = curl_init('http://api.ipstack.com/'.$ipAdress.'?access_key='.$accessKey.''); |
|
| 24 | 4 | curl_setopt($curlh, CURLOPT_RETURNTRANSFER, true); |
|
| 25 | |||
| 26 | |||
| 27 | 4 | $json = curl_exec($curlh); |
|
| 28 | 4 | curl_close($curlh); |
|
| 29 | |||
| 30 | |||
| 31 | |||
| 32 | |||
| 33 | 4 | return $json; |
|
| 34 | } |
||
| 39 |