This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

problem with package http

Old posts that have not been replied to for several years.
Locked
T
Thor

problem with package http

Post by Thor »

i have done this script

package require http

bind pub - !whats pub:whats

proc pub:whats { nick uhost hand chan arg } {
if {[llength $arg]==0} {
putserv "notice $nick :Usage : !whats <web site>"
} else {
set host [lindex $arg 0]
set query "http://www.netcraft.com/oldwhats/?host=$host"
set token [http::config -useragent "Mozilla"]
set token [http::geturl $query]
puts stderr ""
upvar #0 $token state
foreach {name value} $state(meta) {
if {$name == "Server"} {
putserv "notice $nick :Host $host is running $value"
}
}
}
return 0
}

It works but there is a problem. It returns always the same result. Someone can help me ?
e
egghead
Master
Posts: 481
Joined: Mon Oct 29, 2001 8:00 pm
Contact:

Re: problem with package http

Post by egghead »

Thor wrote:i have done this script

[snip]

It works but there is a problem. It returns always the same result. Someone can help me ?
Thats because you are reviewing the HTTP header of www.netcraft.com and not the host value. And netcraft.com will not change its server often. So you will always get: Apache/1.3.26 (Unix) mod_perl/1.27


By the way, why do you connect to netcraft.com and not to the requested host right away?
telnet www.netcraft.com 80
Trying 195.92.95.5...
Connected to www.netcraft.com.
Escape character is '^]'.
GET /oldwhats/?host=www.eggheads.org HTTP/1.0

HTTP/1.1 200 OK
Date: Fri, 25 Oct 2002 11:51:19 GMT
Server: Apache/1.3.26 (Unix) mod_perl/1.27
Connection: close
Content-Type: text/html

<HTML>
<HEAD>
[snip]
T
Thor

Post by Thor »

lol !!! ok i see im so stupid
Locked