PHP Classes


Recommend this page to a friend!
  Classes of John   Get IP by ISP   Download  
Role: Documentation
Content type: text/markdown
Description: Documentation
Class: Get IP by ISP
Get IP address ranges using Web service
Author: By
Last change: errors fixed
Date: 5 years ago
Size: 2,346 bytes


Class file image Download


Simple cURL based console application for getting IP ranges from web-services by city, country (very big size!! i'm really afraid) or ISP. In case of ISP you may specify single ip or web-site url of that provider as argument of script.


  • pear/console_commandline


Install via Composer:

composer require himei/get-ip-by-isp

For manual installation clone repo

git clone

Follow to the root programm folder:

cd getIpbyIsp

Then install dependencies

composer install


Now follow to the src directory in root program folder:

cd src

Make main program file executable:

chmod +x getipbyisp.php

Now use it.

Type next in your console for getting help:

./getipbyisp.php -h


./getipbyisp.php --help

The output:

Console application for getting IP ranges 
from web-services by city, country or ISP

  getipbyisp.php [options] type request

  -o output, --output=output  File to store the result
  -h, --help                  Show this help message and exit

  type     Set the type of which IP ranges will be requested: city, counrty or isp
  request  Request string: for country - 2-letter country code, for city - its name, for ISP - single IP or ISP's url


To get all IP ranges of Serbia

./getipbyisp.php country RS

To get all IP ranges of London and save it to file.txt

./getipbyisp.php city london -o file.txt

To get all IP ranges of Beeline ISP

./getipbyisp.php isp


./getipbyisp.php isp

Warning!!! In case of request by city, write the name of the city carefully and accurately, as much as possible. If an error occurs in the name, the search on the uncleaned database is activated, and the result includes ALL IP ranges from all possible variants. To get the most accurate result, the city name must not contain errors.


  • Tests


For bug reports or any other purpose you may contact me via email [himei at tuta dot io].