Skip to content

Commit 4bdd893

Browse files
committed
Fix PHP examples
1 parent 83ad0fd commit 4bdd893

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

content/geoip/geolocate-an-ip/web-services.md

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,12 +118,18 @@ const client = new WebServiceClient(accountId, licenseKey, {
118118
```
119119

120120
```php
121-
$client = new Client(10, 'LICENSEKEY');
121+
<?php require_once 'vendor/autoload.php'
122+
use GeoIp2\WebService\Client;
123+
124+
$account_id = 10;
125+
$license_key = 'LICENSEKEY';
126+
127+
$client = new Client($account_id, $license_key);
122128

123129
// To query the GeoLite web service, you must set the optional `host` argument.
124130
// The third argument specifies the language preferences when using the `->name`
125131
// method on the model classes that this client creates.
126-
$client = new Client(10, 'LICENSEKEY', ['en'], ['host' => 'geolite.info']);
132+
$client = new Client($account_id, $license_key, ['en'], ['host' => 'geolite.info']);
127133
```
128134

129135
```python
@@ -228,7 +234,10 @@ client.country('142.1.1.1').then((response) => {
228234
<?php require_once 'vendor/autoload.php'
229235
use GeoIp2\WebService\Client;
230236

231-
$client = new Client(10, 'LICENSEKEY');
237+
$account_id = 10;
238+
$license_key = 'LICENSEKEY';
239+
240+
$client = new Client($account_id, $license_key);
232241

233242
// You can also use `$client->city` or `$client->insights`
234243
// `$client->insights` is not available to GeoLite users

0 commit comments

Comments
 (0)