Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Rather than generating a possible database / storage for ~4 billion IP4 addresses (assuming you are only looking at IPv4 ignoring all IPv6 addresses) would it not be easier, and more practical just generate random IP address combinations to test with, which you can easily validate with RegEx?</p> <p>The following regex would allow you to validate any particular IPv4 address from 0.0.0.0 to 255.255.255.255</p> <p><code>\b(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b</code></p> <p>What you do need to remember however is that not all combinations of addresses are classed as 'valid' even if they are syntax correct.</p> <p>Another alternative (as also mentioned by @binaryLV) is using the PHP filter_var($ip, FILTER_VALIDATE_IP); function which is nice and clean. Check the flags out to help filter too over at <a href="http://php.net/manual/en/function.filter-var.php" rel="nofollow">http://php.net/manual/en/function.filter-var.php</a></p> <p><strong>Update</strong></p> <p>For IP location based services I would recommend using a service such as <a href="http://ipinfodb.com/index.php" rel="nofollow">IPInfoDB</a>. They provide both an <a href="http://ipinfodb.com/ip_location_api.php" rel="nofollow">API (see here)</a> to use which allows you to call their service reducing the need to store the information on your database. Else they offer a <a href="http://ipinfodb.com/ip_database.php" rel="nofollow">database of IP addresses (see here)</a> to xxx.xxx.xxx precision that can also be downloaded.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload