geoip redirection for superforex.com.au
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. # MaxMind DB Reader PHP API #
  2. ## Description ##
  3. This is the PHP API for reading MaxMind DB files. MaxMind DB is a binary file
  4. format that stores data indexed by IP address subnets (IPv4 or IPv6).
  5. ## Installation (Composer) ##
  6. We recommend installing this package with [Composer](https://getcomposer.org/).
  7. ### Download Composer ###
  8. To download Composer, run in the root directory of your project:
  9. ```bash
  10. curl -sS https://getcomposer.org/installer | php
  11. ```
  12. You should now have the file `composer.phar` in your project directory.
  13. ### Install Dependencies ###
  14. Run in your project root:
  15. ```
  16. php composer.phar require maxmind-db/reader:~1.0
  17. ```
  18. You should now have the files `composer.json` and `composer.lock` as well as
  19. the directory `vendor` in your project directory. If you use a version control
  20. system, `composer.json` should be added to it.
  21. ### Require Autoloader ###
  22. After installing the dependencies, you need to require the Composer autoloader
  23. from your code:
  24. ```php
  25. require 'vendor/autoload.php';
  26. ```
  27. ## Installation (Standalone) ##
  28. If you don't want to use Composer for some reason, a custom
  29. `autoload.php` is provided for you in the project root. To use the
  30. library, simply include that file,
  31. ```php
  32. require('/path/to/MaxMind-DB-Reader-php/autoload.php');
  33. ```
  34. and then instantiate the reader class normally:
  35. ```php
  36. use MaxMind\Db\Reader;
  37. $reader = new Reader('example.mmdb');
  38. ```
  39. ## Installation (RPM)
  40. RPMs are available in the [official Fedora repository](https://apps.fedoraproject.org/packages/php-maxminddb).
  41. To install on Fedora, run:
  42. ```bash
  43. dnf install php-maxminddb
  44. ```
  45. To install on CentOS or RHEL 7, first [enable the EPEL repository](https://fedoraproject.org/wiki/EPEL)
  46. and then run:
  47. ```bash
  48. yum install php-maxminddb
  49. ```
  50. Please note that these packages are *not* maintained by MaxMind.
  51. ## Usage ##
  52. ## Example ##
  53. ```php
  54. <?php
  55. require_once 'vendor/autoload.php';
  56. use MaxMind\Db\Reader;
  57. $ipAddress = '24.24.24.24';
  58. $databaseFile = 'GeoIP2-City.mmdb';
  59. $reader = new Reader($databaseFile);
  60. // get returns just the record for the IP address
  61. print_r($reader->get($ipAddress));
  62. // getWithPrefixLen returns an array containing the record and the
  63. // associated prefix length for that record.
  64. print_r($reader->getWithPrefixLen($ipAddress));
  65. $reader->close();
  66. ```
  67. ## Optional PHP C Extension ##
  68. MaxMind provides an optional C extension that is a drop-in replacement for
  69. `MaxMind\Db\Reader`. In order to use this extension, you must install the
  70. Reader API as described above and install the extension as described below. If
  71. you are using an autoloader, no changes to your code should be necessary.
  72. ### Installing Extension ###
  73. First install [libmaxminddb](https://github.com/maxmind/libmaxminddb) as
  74. described in its [README.md
  75. file](https://github.com/maxmind/libmaxminddb/blob/master/README.md#installing-from-a-tarball).
  76. After successfully installing libmaxmindb, run the following commands from the
  77. top-level directory of this distribution:
  78. ```
  79. cd ext
  80. phpize
  81. ./configure
  82. make
  83. make test
  84. sudo make install
  85. ```
  86. You then must load your extension. The recommend method is to add the
  87. following to your `php.ini` file:
  88. ```
  89. extension=maxminddb.so
  90. ```
  91. Note: You may need to install the PHP development package on your OS such as
  92. php5-dev for Debian-based systems or php-devel for RedHat/Fedora-based ones.
  93. ## 128-bit Integer Support ##
  94. The MaxMind DB format includes 128-bit unsigned integer as a type. Although
  95. no MaxMind-distributed database currently makes use of this type, both the
  96. pure PHP reader and the C extension support this type. The pure PHP reader
  97. requires gmp or bcmath to read databases with 128-bit unsigned integers.
  98. The integer is currently returned as a hexadecimal string (prefixed with "0x")
  99. by the C extension and a decimal string (no prefix) by the pure PHP reader.
  100. Any change to make the reader implementations always return either a
  101. hexadecimal or decimal representation of the integer will NOT be considered a
  102. breaking change.
  103. ## Support ##
  104. Please report all issues with this code using the [GitHub issue tracker](https://github.com/maxmind/MaxMind-DB-Reader-php/issues).
  105. If you are having an issue with a MaxMind service that is not specific to the
  106. client API, please see [our support page](https://www.maxmind.com/en/support).
  107. ## Requirements ##
  108. This library requires PHP 5.6 or greater.
  109. The GMP or BCMath extension may be required to read some databases
  110. using the pure PHP API.
  111. ## Contributing ##
  112. Patches and pull requests are encouraged. All code should follow the PSR-1 and
  113. PSR-2 style guidelines. Please include unit tests whenever possible.
  114. ## Versioning ##
  115. The MaxMind DB Reader PHP API uses [Semantic Versioning](https://semver.org/).
  116. ## Copyright and License ##
  117. This software is Copyright (c) 2014-2019 by MaxMind, Inc.
  118. This is free software, licensed under the Apache License, Version 2.0.