| View previous topic :: View next topic |
| Author |
Message |
FcLan Halfop
Joined: 30 Sep 2005 Posts: 64 Location: Poland
|
Posted: Fri Dec 16, 2005 1:31 pm Post subject: Small sock problem |
|
|
I`ve a livescore script for my eggdrop. It works, but the problem is it gives results from down from bottom i want to see results from top and not only one, for example frist 5 please help me, thx.
| Code: | set url "www.pilkanozna.pl"
proc get_news {nick uhost handle channel text} {
global url
set sock [socket $url 80]
fconfigure $sock -buffering line -buffersize 1000
puts $sock "GET /pn.php?dzial=online HTTP/1.0"
puts $sock "Host: www.pilkanozna.pl"
puts $sock ""
puts $sock "User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; WindowsNT 5.0)"
flush $sock
while {![eof $sock]} {
gets $sock body
regexp -all {<td align=right>(.*?)</td>} $body _ team1
regexp -all {<td align=center>(.*?)</td>} $body _ result
regexp -all {<td align=left>(.*?)</td>} $body _ team2
}
if {[eof $sock]} { close $sock }
regsub -all {(<.+?>)} $team1"" team1
regsub -all {(<.+?>)} $result"" result
regsub -all {(<.+?>)} $team2"" team2
puthelp "PRIVMSG $channel :[lindex $team1][lindex $result][lindex $team2]"
}
bind pub - !score get_news |
|
|
| Back to top |
|
 |
demond Revered One

Joined: 12 Jun 2004 Posts: 3073 Location: San Francisco, CA
|
Posted: Fri Dec 16, 2005 11:29 pm Post subject: |
|
|
don't use raw sockets for HTTP, use the http package and its [geturl] command _________________ connection, sharing, dcc problems? click <here>
before asking for scripting help, read <this>
use [code] tag when posting logs, code |
|
| Back to top |
|
 |
FcLan Halfop
Joined: 30 Sep 2005 Posts: 64 Location: Poland
|
Posted: Sat Dec 17, 2005 7:36 am Post subject: |
|
|
| Hmm, I understand only a sock.. really can`t change it? |
|
| Back to top |
|
 |
FcLan Halfop
Joined: 30 Sep 2005 Posts: 64 Location: Poland
|
Posted: Sat Dec 17, 2005 7:37 am Post subject: |
|
|
| Can u show me example script "http package and its [geturl] command" ? |
|
| Back to top |
|
 |
avilon Halfop

Joined: 13 Jul 2004 Posts: 64 Location: Germany
|
|
| Back to top |
|
 |
|