Skip to content

Commit bb4bc28

Browse files
committed
Merge pull request #7 from canfiax/master
updated Telize Driver to work with new API endpoint from https://mark…
2 parents b70ef90 + 4b527cb commit bb4bc28

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

src/Drivers/TelizeDriver.php

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,14 @@ 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 = json_decode($this->guzzle->get($this->getUrl($ip), [
21+
'headers' => [
22+
'X-Mashape-Key' => array_get($this->config, 'key'),
23+
'Accept' => 'application/json'
24+
]
25+
])->getBody(), true);
2026
} catch (RequestException $e) {
2127
return [];
2228
}
@@ -30,8 +36,7 @@ public function get($ip)
3036
'region' => array_get($data, 'region'),
3137
'regionCode' => array_get($data, 'region_code'),
3238
'timezone' => array_get($data, 'timezone'),
33-
'postalCode' => array_get($data, 'postal_code'),
34-
'isp' => array_get($data, 'isp'),
39+
'postalCode' => array_get($data, 'postal_code')
3540
];
3641
}
3742

@@ -49,7 +54,7 @@ protected function getUrl($ip)
4954
$protocol = 'https:';
5055
}
5156

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

5459
return $baseUrl.$ip;
5560
}

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)