Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: Pobieranie informacji o IP (whois)
Forum PHP.pl > Forum > Przedszkole
Daimos
Kod
212.182.63.102 = w3cache.lublin.pl
inetnum:      212.182.63.0 - 212.182.63.255
netname:      PL-LUB-MAN-1
descr:        LUBMAN, Provider Local Registry
descr:        Internal Usage (backbone & servers)
country:      PL
admin-c:      AR1187-RIPE
tech-c:       AR1187-RIPE
tech-c:       AU229-RIPE
status:       ASSIGNED PA
remarks:      renumbered from 192.147.37.0
mnt-by:       PL-LUBMAN-MNT
mnt-lower:    PL-LUBMAN-MNT
source:       RIPE

person:       Andrzej Resztak
address:      ZIO UMCS
address:      Pl. Marii Curie-Sklodowskiej 1
address:      20-031 Lublin
address:      POLAND
phone:        +48 81 537 2017
fax-no:       +48 81 537 2027
e-mail:       Andrzej.Resztak@man.lublin.pl
nic-hdl:      AR1187-RIPE
mnt-by:       PL-LUBMAN-MNT
source:       RIPE

person:       Artur Urbanowicz
address:      LubMAN UMCS
address:      Pl. Marii Curie-Sklodowskiej 1
address:      20-031 Lublin
address:      Poland
phone:        +48 81 5376278
fax-no:       +48 81 5376295
e-mail:       Artur.Urbanowicz@man.lublin.pl
nic-hdl:      AU229-RIPE
source:       RIPE


route:        212.182.0.0/18
descr:        academic part of Lublin MAN, Poland
origin:       AS12324
remarks:      removed cross-nfy:    AR1187-RIPE
mnt-by:       PL-LUBMAN-MNT
source:       RIPE

no wlasnie, jak takie cos uzyskac snitch.gif?
mario
Może to Ci pomoże? Skrypt tellme podaje informacje nt. DNS, whois, traceroute, serwera, itp.
crash
Bodajże Bakus publikował na forum swoją klase, która pobiera te dane z ripe.net. Poszukaj.
Daimos
szukalem juz dluuuuugo
znalazlem cos takiego:
  1. <?php
  2. class whois
  3. {
  4. var $server;
  5. var $port;
  6. var $data;
  7.  
  8. function set_server($server)
  9. {
  10. $this->server = $server;
  11. }
  12.  
  13. function set_port($port)
  14. {
  15. $this->port = $port;
  16. }
  17.  
  18. function query($adress)
  19. {
  20. $fp = fsockopen($this->server, $this->port);
  21. if (!$fp)
  22. {
  23.  $this->data = 0;
  24.  return FALSE;
  25. }
  26. else
  27. {
  28. fputs($fp, &#092;"$adressn\");
  29. $this->data = fread($fp, 16384);
  30. fclose($fp);
  31. return TRUE;
  32. }
  33. }
  34.  
  35. function get_info()
  36. {
  37. $lines = split(&#092;"n\", $this->data);
  38. while (list($key, $value) = each($lines))
  39. if (ereg(&#092;"descr: +(.*)\", $value, $match))
  40. $info .= &#092;"$match[1]n\";
  41. return $info;
  42. }
  43.  
  44. }
  45.  
  46. $whois = new whois;
  47. $whois->set_server(&#092;"whois.ripe.net\");
  48. $whois->set_port(43);
  49. if($whois->query($q))
  50. if($whois->get_info())
  51. $info = $whois->get_info();
  52. else
  53. $info = &#092;"Brak danychn\";
  54.  
  55. ?>
  56. <html>
  57.  
  58. <head></head>
  59.  
  60. <body bgcolor=white>
  61.  
  62. <br>
  63. <br>
  64.  
  65. <table align=center width=400 border=1 bordercolor=#d0d0d0>
  66. <tr bgcolor=#d0d0d0>
  67. <td>
  68. <big><?php echo $q;?></big>
  69. </td>
  70. </tr>
  71. <tr>
  72. <td>
  73. <pre><?php echo $info;?></pre>
  74. </td>
  75. </tr>
  76. </table>
  77.  
  78. </body>
  79.  
  80. </html>

ale za kazdym razem, przy kazdym ip zwraca
Kod
Brak danych
PUPI
http://forum.php.pl/index.php?showtopic=25...ndpost&p=151693

Kod, który podał Bakuś trzeba trochę zmodyfikować.
Daimos
  1. <?php
  2. $target = $_SERVER[&#092;"REMOTE_ADDR\"];
  3. $server = &#092;"whois.ripe.net\";
  4. print &#092;"<b>Info dla:</b> \" . $target . \"<br />\";
  5. $target = gethostbyname($target);
  6. if (! $sock = fsockopen($server, 43, $num, $error, 20))
  7. {
  8. unset($sock);
  9. $msg .= &#092;"Timed-out connecting to $server (port 43)\";
  10. }else{
  11. fputs($sock, &#092;"$targetn\");
  12. while (!feof($sock))
  13. {
  14. $buffer .= fgets($sock, 10240);
  15. }
  16. fclose($sock);
  17. }
  18. $buffer = explode(&#092;"n\", $buffer);
  19. foreach($buffer as $line)
  20. {
  21. $line = preg_replace('/s+/', ' ', $line);
  22. $line = explode(&#092;":\", $line);
  23. $line[1] = trim($line[1]);
  24. if($line[0] == &#092;"inetnum\" || $line[0] == \"netname\" || $line[0] == \"descr\" || $line[0] == \"country\")
  25. {
  26. if(empty($data[$line[0]]))
  27. {
  28. $data[$line[0]] = $line[1];
  29. }else{
  30. $data[$line[0]] .= &#092;" \" . $line[1];
  31. }
  32. }
  33. if($line[0] == &#092;"country\")
  34. {
  35. break;
  36. }
  37. }
  38. print_r($data);
  39. ?>

tylko co tu zmodyfikowac zeby mi wyswietlalo WSZYSTKIE mozliwe informacje
troche to za ciezki kod jak dlamnie i niewiem sad.gif
i jak zrobic zeby nie wyswietlalo tego w postaci: array.......
tylko normalnie:
country: xxx
netname: asdasdasd

ps. skrypt tellme nie dziala dobrze, wyswietla wiele, ale wlasnie whois nie dziala :/
mario
lub też zastosuj klasę domain z www.classes.org która podaje wszystkie informacje jak na Twoim "wykazie"
Daimos
zastosowalem ta klase i caly czas mam cos takiego :[

Kod
Domainname isn't valid!
Domainname isn't valid!

Domain is available
Whois Server:
Domain: w3cache
Tld: lublin.pl
Domain name isn't valid!


30% w sieci ma mozliwosc sprawdzenia ip i wyswietla wiele informacji, a okazuje sie ze to nie takie proste :/
PUPI
  1. <?php
  2. $target = $_SERVER[&#092;"REMOTE_ADDR\"];
  3. $server = &#092;"whois.ripe.net\";
  4. print &#092;"<b>Info dla:</b> \" . $target . \"<br />\";
  5. $target = gethostbyname($target);
  6. if (! $sock = fsockopen($server, 43, $num, $error, 20))
  7. {
  8. unset($sock);
  9. $msg .= &#092;"Timed-out connecting to $server (port 43)\";
  10. }else{
  11. fputs($sock, &#092;"$targetn\");
  12. while (!feof($sock))
  13. {
  14. $buffer .= fgets($sock, 10240);
  15. }
  16. fclose($sock);
  17. }
  18. $buffer = str_replace(&#092;"n\", \"<br />\", $buffer);
  19.  
  20. echo ($buffer);
  21. ?>

Po takiej modyfikacji kodu Bakusia powinna wyświetlać sie cała odpowiedź serwera whois.ripe.net.
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.