Home Backend Development PHP Tutorial One can obtain the geographical location of the website and the server operating system php_PHP tutorial

One can obtain the geographical location of the website and the server operating system php_PHP tutorial

Jul 14, 2016 am 10:07 AM
error head php Can geographical location operating system server website Obtain

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.1rnHost:”.$host.”rnConnection: Closernrn”;
        @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.1rnHost:”.$host.”rnConnection: Closernrn”;
            @fputs($fp,$get);
            $data = ”;
            while ($fp && !feof($fp))
            $data .= fread($fp, 1024);
            @fclose($fp);
            $array = explode(“n”,$data);
            $k = 2;
            for($i = 0;$i < 20;$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.
    ’.”rn”;
            $get = “GET / HTTP/1.1rnHost:”.$host.”rnConnection: Closernrn”;
            @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:

    ’.”rn”;
            ob_flush();
            flush();
            for($i = 0;$i < $num;$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....
    Statement of this Website
    The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

    Hot AI Tools

    Undresser.AI Undress

    Undresser.AI Undress

    AI-powered app for creating realistic nude photos

    AI Clothes Remover

    AI Clothes Remover

    Online AI tool for removing clothes from photos.

    Undress AI Tool

    Undress AI Tool

    Undress images for free

    Clothoff.io

    Clothoff.io

    AI clothes remover

    AI Hentai Generator

    AI Hentai Generator

    Generate AI Hentai for free.

    Hot Article

    R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
    3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
    R.E.P.O. Best Graphic Settings
    3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
    R.E.P.O. How to Fix Audio if You Can't Hear Anyone
    3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
    WWE 2K25: How To Unlock Everything In MyRise
    3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

    Hot Tools

    Notepad++7.3.1

    Notepad++7.3.1

    Easy-to-use and free code editor

    SublimeText3 Chinese version

    SublimeText3 Chinese version

    Chinese version, very easy to use

    Zend Studio 13.0.1

    Zend Studio 13.0.1

    Powerful PHP integrated development environment

    Dreamweaver CS6

    Dreamweaver CS6

    Visual web development tools

    SublimeText3 Mac version

    SublimeText3 Mac version

    God-level code editing software (SublimeText3)

    Explain the match expression (PHP 8 ) and how it differs from switch. Explain the match expression (PHP 8 ) and how it differs from switch. Apr 06, 2025 am 12:03 AM

    In PHP8, match expressions are a new control structure that returns different results based on the value of the expression. 1) It is similar to a switch statement, but returns a value instead of an execution statement block. 2) The match expression is strictly compared (===), which improves security. 3) It avoids possible break omissions in switch statements and enhances the simplicity and readability of the code.

    What is Cross-Site Request Forgery (CSRF) and how do you implement CSRF protection in PHP? What is Cross-Site Request Forgery (CSRF) and how do you implement CSRF protection in PHP? Apr 07, 2025 am 12:02 AM

    In PHP, you can effectively prevent CSRF attacks by using unpredictable tokens. Specific methods include: 1. Generate and embed CSRF tokens in the form; 2. Verify the validity of the token when processing the request.

    Is H5 page production a front-end development? Is H5 page production a front-end development? Apr 05, 2025 pm 11:42 PM

    Yes, H5 page production is an important implementation method for front-end development, involving core technologies such as HTML, CSS and JavaScript. Developers build dynamic and powerful H5 pages by cleverly combining these technologies, such as using the &lt;canvas&gt; tag to draw graphics or using JavaScript to control interaction behavior.

    Describe the purpose and usage of the ... (splat) operator in PHP function arguments and array unpacking. Describe the purpose and usage of the ... (splat) operator in PHP function arguments and array unpacking. Apr 06, 2025 am 12:07 AM

    The... (splat) operator in PHP is used to unpack function parameters and arrays, improving code simplicity and efficiency. 1) Function parameter unpacking: Pass the array element as a parameter to the function. 2) Array unpacking: Unpack an array into another array or as a function parameter.

    How can you prevent a class from being extended or a method from being overridden in PHP? (final keyword) How can you prevent a class from being extended or a method from being overridden in PHP? (final keyword) Apr 08, 2025 am 12:03 AM

    In PHP, the final keyword is used to prevent classes from being inherited and methods being overwritten. 1) When marking the class as final, the class cannot be inherited. 2) When marking the method as final, the method cannot be rewritten by the subclass. Using final keywords ensures the stability and security of your code.

    The difference between H5 and mini-programs and APPs The difference between H5 and mini-programs and APPs Apr 06, 2025 am 10:42 AM

    H5. The main difference between mini programs and APP is: technical architecture: H5 is based on web technology, and mini programs and APP are independent applications. Experience and functions: H5 is light and easy to use, with limited functions; mini programs are lightweight and have good interactiveness; APPs are powerful and have smooth experience. Compatibility: H5 is cross-platform compatible, applets and APPs are restricted by the platform. Development cost: H5 has low development cost, medium mini programs, and highest APP. Applicable scenarios: H5 is suitable for information display, applets are suitable for lightweight applications, and APPs are suitable for complex functions.

    Explain strict types (declare(strict_types=1);) in PHP. Explain strict types (declare(strict_types=1);) in PHP. Apr 07, 2025 am 12:05 AM

    Strict types in PHP are enabled by adding declare(strict_types=1); at the top of the file. 1) It forces type checking of function parameters and return values ​​to prevent implicit type conversion. 2) Using strict types can improve the reliability and predictability of the code, reduce bugs, and improve maintainability and readability.

    What is the difference between H5 page production and WeChat applets What is the difference between H5 page production and WeChat applets Apr 05, 2025 pm 11:51 PM

    H5 is more flexible and customizable, but requires skilled technology; mini programs are quick to get started and easy to maintain, but are limited by the WeChat framework.

    See all articles