| Conditions | 1 |
| Paths | 1 |
| Total Lines | 14 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 14 | public function collect(): array |
||
| 15 | { |
||
| 16 | // @todo use already collected ip address |
||
| 17 | $ip = file_get_contents('https://api.ipify.org'); |
||
| 18 | $data = json_decode(file_get_contents("http://ip-api.com/json/" . $ip), true); |
||
| 19 | |||
| 20 | $asnArray = explode(' ' , $data['as']); |
||
| 21 | |||
| 22 | $asn = substr($asnArray[0], 2); |
||
| 23 | $isp = $data['isp']; |
||
| 24 | |||
| 25 | return [ |
||
| 26 | 'asn' => $asn, |
||
| 27 | 'isp' => $isp |
||
| 28 | ]; |
||
| 31 |