Greip API Docs
Pricings
Sign in
Sign up
Contact
Search…
Overview
GET STARTED
Authentication
HTTPS Support
Error Codes
Usage Limits
Additional Information
OPTIONS
Custom Modules Response
Response Format
Localization
Development Environment
METHODS
Lookup IP Address
Retrieve Visitor Info
Country Data API
Bulk Lookup
Bad Words Detection
MORE
Callback
Code Samples
Limitations
Tools & Libraries
PHP
Lookup Method
Country Method
JS
GeoIP CLI
Dashboard Guide
Obtaining an API Key
Protecting your API Key
Renewing your plan
Powered By
GitBook
PHP
The Javascript library of the API.
Requirements
php: >=7.4
Installation
1
composer require gre/geoip
Copied!
Importing the library
1
include_once
'./vendor/autoload.php'
;
2
3
// Using the library
4
use
GRE
\
GeoIP
\
GeoIP
;
5
6
// Declaring the library's class
7
$GREGeoIP
=
new
GeoIP
();
Copied!
The
$GREGeoIP
variable will be used to call the API methods and functions.
Setting the API Key
Before we can use the methods of this library we have to set our
API Key
. This can be done by calling the
setKey
function:
1
$GREGeoIP
->
setKey
(
'<API-Key>'
);
Copied!
DO NOT forget to change the
<API-Key>
with your own
API Key
. If you don't have one, please take a look at the
Quick Start
page.
Methods & Usage
After importing and defining the package you're ready now to use all it's functionalities. The library is consist or 2 main methods.
Lookup Method
Country Method
MORE - Previous
Limitations
Next
Lookup Method
Last modified
4mo ago
Copy link
Contents
Requirements
Installation
Importing the library
Setting the API Key
Methods & Usage