Home php Single WHOIS IP

Single WHOIS IP

Author

Date

Category

You need to find out the operator and the country of the visitor.

used WHOIS:

$ ip = $ _server ['remote_addr'];
  Function WHOIS ($ ip) {
    $ SOCK = FSOCKOPEN ("WHOIS.RIPE.NET", 43, $ ERRNO, $ ERRSTR);
    If (! $ SOCK) {
      echo ("$ errno ($ errstr)");
      Return;
    }
    ELSE {
      FPUTS ($ SOCK, $ ip. "\ r \ n");
      While (! Feof ($ SOCK)) {
        ECHO (STR_REPLACE (":", ":", FGETS ($ SOCK, 128)). "& lt; br & gt;");
      }
    }
    FCLOSE ($ SOCK);
  }
Echo (WHOIS ($ IP));

At the output I receive a list with info, you need to lay out from there the desired pairs of values.
If anyone knows another way to identify the visitor operator and / or the base of the IP operators, I will be immensely grateful.


Answer 1, Authority 100%

$ ip = '8.8.8.8';
$ geo = json_decode (file_get_contents ("http://api.2iP.com.ua/geo.json?ip=jeo}"), true);
$ provider = json_decode (file_get_contents ("http://api.2ip.com.ua/provider.json?ip=u)"), true);
Print_R ($ Geo);
Print_R ($ Provider);

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions