but for some dark reason, the script does not work. the script doesn't do anything...
anybody some advice???
tnx!
btw, i can't put the code in
Code: Select all
#!/bin/sh
# restart using tclsh
bind pub - !h pub_horoscoop
proc pub_horoscoop {n u h c} {
exec /usr/bin/tclsh "$0" "$@"
package require http
putlog "<< $n >> !horoscoop!"
proc htmlstrip {input} {
set htmllen [string length $input];set pos 0;set on 1;set output ""
while {$pos < $htmllen} {
set char [string index $input $pos]
if {$char == "<"} {set on 0}
if {$char == ">"} {set on 1;set char ""}
if {$on == 1} {append output $char}
incr pos
}
return $output
}
set url "http://horoscope.tiscali.be/nl/scorpio.html"
set mytoken [::http::geturl $url]
set pdata [::http::data $mytoken]
set status [::http::status $mytoken]
upvar #0 $mytoken state
set meta $state(meta)
set clean [::http::cleanup $mytoken]
set nummeta [llength $meta]
set cookies ""
for {set x 0} {$x < $nummeta} {incr x} {
set mkey [lindex $meta $x]
incr x
set mval [string trimleft [lindex $meta $x]]
if {$mkey == "Set-Cookie"} {
puts "mval is ($mval)"
append cookies "Cookie "
append cookies "$Version=1;[lindex $mval 0] "
}
}
set cookies [string trimright $cookies]
set last [string length $cookies]
if {[string index $cookies end] == ";"} {set cookies [string range $cookies 0 [expr $last -2]]}
#puts "cookies are ($cookies)"
if {$status == "timeout"} {puts "der is lag bij de site, probeer straks opnieuw"; exit}
regexp {<br><div align="JUSTIFY"><font face="Arial" size="-1">([^<]+)</font>} $pdata a b
puts [join [split $b n]]
}
<font size=-1>[ This Message was edited by: Mentolboy on 2002-04-03 12:07 ]</font>