From 2de2cb779fc45d8cd46ab146859d6ab3e90d09a7 Mon Sep 17 00:00:00 2001 From: Gregory Oschwald Date: Tue, 7 May 2013 11:17:38 -0700 Subject: [PATCH] Started filling in Client --- src/GeoIP2/Webservice/Client.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/GeoIP2/Webservice/Client.php b/src/GeoIP2/Webservice/Client.php index 84092ca..c4fee44 100644 --- a/src/GeoIP2/Webservice/Client.php +++ b/src/GeoIP2/Webservice/Client.php @@ -9,12 +9,14 @@ use GeoIP2\Model\City; use GeoIP2\Model\CityISPOrg; use GeoIP2\Model\Country; use GeoIP2\Model\Omni; +use Guzzle\Http\Client as GuzzleClient; class Client { private $user_id; private $license_key; + private $base_uri = 'https://geoip.maxmind.com/geoip/v2.0'; function __construct($user_id, $license_key) { @@ -44,7 +46,12 @@ class Client private function response_for($path, $ip_address) { - + $uri = implode('/', array($this->base_uri, $path, $ip_address)); + $client = new GuzzleClient(); + $request = $client->get($uri, array('Accept' => 'application/json')); + $request->setAuth($this->user_id, $this->license_key); + $response = $request->send(); + echo $response->getBody(); } private function handle_success($response, $uri)