#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2000
    Location
    Melbourne, Victoria, Australia
    Posts
    104
    Rep Power
    14
    Hi,

    Does anyone know how to get the server ID from an external web server? Like what they do on the Netcraft web server survey, how it returns the string saying Apache 1.3.14 / PHP 4.0.3 FreeBSD etc etc etc?

    Is there a HTTP request or something?
  2. #2
  3. No Profile Picture
    freebsd
    Guest
    Devshed Newbie (0 - 499 posts)
    Start here -> http://www.netcraft.com/os/accuracy.html

    To get that locally, try $ENV{'SERVER_SOFTWARE'}

    Don't forget to check out -> http://www.apache.org/docs/mod/core.html#servertokens

    For security reasons, many servers tend to hide the SERVER_SOFTWARE or set it to minimal.

    [This message has been edited by freebsd (edited October 18, 2000).]
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2000
    Location
    Melbourne, Victoria, Australia
    Posts
    104
    Rep Power
    14
    Hmm thanks.

    I had a look at the netcraft page and it doesn't actually explain how to get the response. Does the server send it's id with EVERY http response eg GET request or do you have to pass a specific http header or something?

    [This message has been edited by #6 (edited October 19, 2000).]
  6. #4
  7. No Profile Picture
    freebsd
    Guest
    Devshed Newbie (0 - 499 posts)
    >>I had a look at the netcraft page and it doesn't actually explain how to get the response

    I thought I gave you this link -> http://www.netcraft.com/os/accuracy.html Such link is to DETERMINE the OS since most of the time, the value is just "Apache/1.3.12 (Unix) " UNIX doesn't tell you whether it's FreeBSD or Linux or something else as there is NO WAY to get the accurate result. So netcraft actually uses a PROXY server, specifically SQUID, to look up the cache for the Server OS.

    >>do you have to pass a specific http header or something?

    Hehe, how about showing you a working example in Perl?

    #############################################
    #!/usr/local/bin/perl

    use LWP::UserAgent;
    my $URL = "http://www.devshed.com";
    my $ua = new LWP::UserAgent;
    $ua->timeout(60);
    $ua->agent("Testing " . $ua->agent);
    my $req = new HTTP::Request GET => $URL;
    my $res = $ua->request($req);
    my $mess = $res->server;

    if ($res->is_success) {
    &output_status($mess);
    exit;
    }
    else {
    &output_status("is_success Failed");
    exit;
    }

    sub output_status {
    my (@messages) = @_;
    print "Content-type: text/htmlnn";
    my $message;
    foreach $message (@messages) {
    print $message;
    }
    }
    #############################################

    The result should be:

    InfoWest.COM-CUSTOM-Apache/2.5.6

    That's the server software for infowest.com, where Devshed.com hosts at.

    If you go to: http://www.netcraft.com/whats/?host=www.devshed.com

    You would get: www.devshed.com is running InfoWest.COM-Custom-Apache/2.5.6 on FreeBSD

    You see the difference is the OS (FreeBSD) which is determined by the Squid Proxy Server's cache as mentioned in http://www.netcraft.com/os/accuracy.html

IMN logo majestic logo threadwatch logo seochat tools logo