egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Small sock problem

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
FcLan
Halfop


Joined: 30 Sep 2005
Posts: 64
Location: Poland

PostPosted: Fri Dec 16, 2005 1:31 pm    Post subject: Small sock problem Reply with quote

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
View user's profile Send private message
demond
Revered One


Joined: 12 Jun 2004
Posts: 3073
Location: San Francisco, CA

PostPosted: Fri Dec 16, 2005 11:29 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
FcLan
Halfop


Joined: 30 Sep 2005
Posts: 64
Location: Poland

PostPosted: Sat Dec 17, 2005 7:36 am    Post subject: Reply with quote

Hmm, I understand only a sock.. really can`t change it?
Back to top
View user's profile Send private message
FcLan
Halfop


Joined: 30 Sep 2005
Posts: 64
Location: Poland

PostPosted: Sat Dec 17, 2005 7:37 am    Post subject: Reply with quote

Can u show me example script "http package and its [geturl] command" ?
Back to top
View user's profile Send private message
avilon
Halfop


Joined: 13 Jul 2004
Posts: 64
Location: Germany

PostPosted: Sat Dec 17, 2005 9:38 am    Post subject: Reply with quote

http://forum.egghelp.org/search.php
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber