Heim >Backend-Entwicklung >PHP-Tutorial >一个可以获取网站地理位置,服务器操作系统php_PHP教程

一个可以获取网站地理位置,服务器操作系统php_PHP教程

WBOY
WBOYOriginal
2016-07-14 10:07:221221Durchsuche

error_reporting(E_ERROR);

header(“content-Type: text/html; charset=gb2312″);
set_time_limit(120);
$host = isset($_POST['url']) ? chop(str_replace(‘http://’,”,$_POST['url'])) : ‘ www.2cto.com ’;
$port = isset($_POST['duankou']) ? chop($_POST['duankou']) : ’80′;
$num  = 10;
function microtime_float()
{
        list($usec, $sec) = explode(” “, microtime());
        return ((float)$usec + (float)$sec);
}
function ip138($url)
{
        $host = ‘www.ip138.com’;
        $fp = @fsockopen($host,80,&$errno,&$errstr,3);
        $get = “GET /ips.asp?ip=”.$url.” HTTP/1.1\r\nHost:”.$host.”\r\nConnection: Close\r\n\r\n”;
        @fputs($fp,$get);
        $data = ”;
        while ($fp && !feof($fp))
        $data .= fread($fp, 1024);
        @fclose($fp);
        $s1 = ‘\’;
        $s2 = ‘\’;
        $tmp = array();
        preg_match_all(“/”.$s1.”([^~]*?)”.$s2.”/i”,$data,$tmp);
        $tmp1 = array();
        preg_match_all(“/\
  • ([^~]*?)\/i”,$tmp[0][0],$tmp1);
  •         return $tmp1[0][0].$tmp1[0][1].$tmp1[0][2];
    }
    function getsoft($host,$port)
    {
            $fp = @fsockopen($host,$port,&$errno,&$errstr,3);
            if(!$fp) return ‘unknown’;
            $get = “GET / HTTP/1.1\r\nHost:”.$host.”\r\nConnection: Close\r\n\r\n”;
            @fputs($fp,$get);
            $data = ”;
            while ($fp && !feof($fp))
            $data .= fread($fp, 1024);
            @fclose($fp);
            $array = explode(“\n”,$data);
            $k = 2;
            for($i = 0;$i
            {
                    if(stristr($array[$i],’Server’)){$k = $i; break;}
            }
            if(!stristr($array[$k],’Server’)) return ‘unknown’;
            else return str_replace(‘Server’,'服务器软件’,$array[$k]);
    }
    function ping($host,$port)
    {
            $time_start = microtime_float();
            $ip = gethostbyname($host);
            $fp = @fsockopen($host,$port,&$errno,&$errstr,1);
            if(!$fp) return ‘Request timed out.
    ’.”\r\n”;
            $get = “GET / HTTP/1.1\r\nHost:”.$host.”\r\nConnection: Close\r\n\r\n”;
            @fputs($fp,$get);
            @fclose($fp);
            $time_end = microtime_float();
            $time = $time_end – $time_start;
            $time = ceil($time * 1000);
            return ‘Reply from ‘.$ip.’: time=’.$time.’ms
    ’;
    }
    if(isset($_POST['url']) && isset($_POST['duankou']))
    {
            echo ip138($host).’

    ’;
            echo ‘’.getsoft($host,$port).’

    ’;
            echo ‘Pinging ‘.$host.’ ['.gethostbyname($host).'] with Port:’.$port.’ of data:

    ’.”\r\n”;
            ob_flush();
            flush();
            for($i = 0;$i
            {
                    echo ping($host,$port);
                    ob_flush();
                    flush();
                    sleep(1);
            }
    }
    ?>
    域名/IP:” size=”50″>
    端口:” size=”10″>
     

    www.bkjia.comtruehttp://www.bkjia.com/PHPjc/477868.htmlTechArticle?php error_reporting(E_ERROR); header(content-Type: text/html; charset=gb2312); set_time_limit(120); $host = isset($_POST[url]) ? chop(str_replace(http://,,$_POST[url])) : www.2cto....
    Stellungnahme:
    Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn