Jump to content

how to get all ip from a page


redarrow

Recommended Posts

the url off php.net is only an example the reel address has ip's on it.

 

<?php
$fp = fsockopen ("www.php.net", 80, $errno, $errstr, 30);
if(!$fp) {
   echo $errstr;
  $x= eregi("^[0-9]{1,3}\.+[0-9]{1,3}\.+[0-9]{1,3}\.+[0-9]{1,3}$",$fp);
} else {
   fwrite($fp, "GET / HTTP/1.1\r\nHost: $x\r\nConnection: Keep-Alive\r\n\r\n");
   $data = '';
   while(!feof($fp)) {
       $data .= fread($fp, 4096);
       if(substr($data, -9)=="\r\n\r\n0\r\n\r\n") {
           exit;
       }
   }
}
echo $data;
?>

 

 

Link to comment
https://forums.phpfreaks.com/topic/41289-how-to-get-all-ip-from-a-page/
Share on other sites

why dont this work please just blank screen not sure but i think

the preg_match wrong.

 

should display all the ip's on the website.

<?php

echo get_url_title("http://www.kloth.net/internet/badbots-2003.php");

function get_url_title($url, $timeout = 2)
{
   $url = parse_url($url);

   if(!in_array($url['scheme'],array('','http')))
       return;

   $fp = fsockopen ($url['host'], ($url['port'] > 0 ? $url['port'] : 80),
$errno, $errstr, $timeout);
   if (!$fp)
   {
       return;
       // echo "$errstr ($errno)<br>\n";
   }
   else
   {
       fputs ($fp, "GET /".$url['path'].($url['query'] ? '?'.$url['query'] : '')." HTTP/1.0\r\nHost:
".$url['host']."\r\n\r\n");
       $d = '';
       while (!feof($fp))
       {
           $d .= fgets ($fp,2048);

           if(preg_match('/^[0-9]{1,3}\.+[0-9]{1,3}\.+[0-9]{1,3}\.+[0-9]{1,3}/', $d, $m))
               break;
       }
       fclose ($fp);

       return $m[3];
   }
}
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.