Skip to content

Commit 60916e6

Browse files
committed
updated Telize Driver to work with new API endpoint from https://market.mashape.com/fcambus/telize
1 parent b70ef90 commit 60916e6

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

src/Drivers/TelizeDriver.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,15 @@ class TelizeDriver extends AbstractGeoIPDriver
1515
*/
1616
public function get($ip)
1717
{
18+
1819
try {
19-
$data = json_decode($this->guzzle->get($this->getUrl($ip))->getBody(), true);
20+
$data = $this->requester->headers(['X-Mashape-Key' => array_get($this->config, 'key'), 'Accept' => 'application/json'])->url($this->getUrl($ip))->get()->json();
2021
} catch (RequestException $e) {
2122
return [];
2223
}
2324

25+
dd($data);
26+
2427
return [
2528
'city' => array_get($data, 'city'),
2629
'country' => array_get($data, 'country'),
@@ -31,7 +34,7 @@ public function get($ip)
3134
'regionCode' => array_get($data, 'region_code'),
3235
'timezone' => array_get($data, 'timezone'),
3336
'postalCode' => array_get($data, 'postal_code'),
34-
'isp' => array_get($data, 'isp'),
37+
'isp' => array_get($data, 'organization'), // unsure what to return here; previously it was 'isp', but that does not exist anylonger.
3538
];
3639
}
3740

@@ -49,7 +52,7 @@ protected function getUrl($ip)
4952
$protocol = 'https:';
5053
}
5154

52-
$baseUrl = $protocol.'//www.telize.com/geoip/';
55+
$baseUrl = $protocol.'//telize-v1.p.mashape.com/geoip/';
5356

5457
return $baseUrl.$ip;
5558
}

src/config/config.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,18 @@
4646
/*
4747
|--------------------------------------------------------------------------
4848
| Telize Driver
49+
| Get your API key here: https://market.mashape.com/fcambus/telize
4950
|--------------------------------------------------------------------------
5051
*/
5152
'telize' => [
53+
/*
54+
|--------------------------------------------------------------------------
55+
| Telize Service Key
56+
|--------------------------------------------------------------------------
57+
*/
58+
59+
'key' => env('GEOIP_TELIZE_KEY'),
60+
5261
/*
5362
|--------------------------------------------------------------------------
5463
| Telize Secure connection

0 commit comments

Comments
 (0)