Skip to content
Permalink
Browse files

Update ReadMe.md

  • Loading branch information...
nathan-fiscaletti committed Jul 18, 2018
1 parent cc3f1f7 commit a9090ee85be85ccd98b0cebd7a2145e170987c33
Showing with 19 additions and 23 deletions.
  1. +19 −23 ReadMe.md
@@ -18,39 +18,18 @@ Learn more about IPStack here: [ipstack.net](https://ipstack.com/product)

### Example Usage

#### Include the `GeoLookup` class in your code.
```php
use IPStack\PHP\GeoLookup;
```

#### Create the GeoLookup object

```php
// Initialize with your IPStack API Key.
use IPStack\PHP\GeoLookup;
$geoLookup = new GeoLookup(
'acecac3893c90871c3', // API Key
false, // Use HTTPS (IPStack Basic plan and up only, defaults to false)
10 // Timeout in seconds (defaults to 10 seconds)
);
```

#### Using the the Legacy [FreeGeoIP Binary](https://github.com/fiorix/freegeoip/releases/)

You can still use the legacy FreeGeoIP Binary hosted on a server
> Note: [FreeGeoIP has been deprecated](https://github.com/apilayer/freegeoip/#freegeoip---important-announcement).
```php
use IPStack\Legacy\FreeGeoIp as GeoLookup;
// Address, Port, Protocol, Timeout
$geoLookup = new GeoLookup(
'localhost', // Address hosting the legacy FreeGeoIP Binary
8080, // Port that the binary is running on (defaults to 8080)
'http', // Protocol to use (defaults to http)
10 // Timeout (defaults to 10 seconds)
);
```

#### Lookup a location for an IP Address

> Note: Locations are returned using a library called ExtendedArrays.
@@ -92,4 +71,21 @@ try {
}
```

#### Using the the Legacy [FreeGeoIP Binary](https://github.com/fiorix/freegeoip/releases/)

You can still use the legacy FreeGeoIP Binary hosted on a server
> Note: [FreeGeoIP has been deprecated](https://github.com/apilayer/freegeoip/#freegeoip---important-announcement).
```php
use IPStack\Legacy\FreeGeoIp as GeoLookup;
// Address, Port, Protocol, Timeout
$geoLookup = new GeoLookup(
'localhost', // Address hosting the legacy FreeGeoIP Binary
8080, // Port that the binary is running on (defaults to 8080)
'http', // Protocol to use (defaults to http)
10 // Timeout (defaults to 10 seconds)
);
```

> Note: See [Location.php](https://github.com/nathan-fiscaletti/ipstackgeo-php/blob/v1.3/src/IPStack/Location.php) for a list of available properties on the Location object.

0 comments on commit a9090ee

Please sign in to comment.
You can’t perform that action at this time.