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 

Egghttp, sockets in sockets..

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


Joined: 02 Jun 2007
Posts: 13

PostPosted: Fri Jun 08, 2007 11:02 am    Post subject: Egghttp, sockets in sockets.. Reply with quote

I am creating an online database, So I need to connect to a webpage, read the first line, open another connection, fill in some data, and then go to the second, and so on.


Now, I have this:

Code:
et url "http://localhost/akicks/todo.php"
set trigger "!test"


if {![info exists egghttp(version)]} {
  putlog "egghttp.tcl was NOT successfully loaded."
  putlog "http-akicks.tcl has not been loaded as a result."
} else {
  proc your_callbackproc {sock} {
    global url
    set headers [egghttp:headers $sock]
    set body [egghttp:data $sock]
    foreach line [split $body \n] {
    regsub -all -nocase {<br>} $line "" line
    regsub -all -nocase {<b>} $line "" line
    regsub -all -nocase {</b>} $line "" line
    set id [lindex $line 0]
    set secondline [string trimleft $line $id]
    set com [lindex $secondline 0]
    set newurl "http://localhost/akicks/mark.php?id=$id&com=$com&pass=12ledro"
    set sockset [egghttp:geturl $newurl akick_proc]
    return 1

}
proc akick_proc {sock} {
    set headersset [egghttp:headers $sockset]
    set bodyset [egghttp:data $sockset]
    foreach line [split $body \n]
    if {$bodyset == "Ok"} {
      putlog "success"
    }
}
}

  bind dcc o|o $trigger our:dcctrigger
  bind pub o|o $trigger our:pubtrigger
  proc our:dcctrigger {hand idx text} {
    global url
    set sock [egghttp:geturl $url your_callbackproc]
    return 1
  } 
  proc our:pubtrigger {nick host hand chan arg} {
    global url
    set sock [egghttp:geturl $url your_callbackproc]
    return 1
  }
  putlog "http-akicks.tcl has been successfully loaded."
}





But this only seems to work for the first line. Any suggestions?
Back to top
View user's profile Send private message
leandro
Voice


Joined: 02 Jun 2007
Posts: 13

PostPosted: Sun Jun 10, 2007 7:01 am    Post subject: Reply with quote

Anyone? Pleaseee?
Back to top
View user's profile Send private message
rosc2112
Revered One


Joined: 19 Feb 2006
Posts: 1454
Location: Northeast Pennsylvania

PostPosted: Sun Jun 10, 2007 8:50 pm    Post subject: Reply with quote

Switch to the http module that comes with tcl and I might be able to help.
Back to top
View user's profile Send private message
leandro
Voice


Joined: 02 Jun 2007
Posts: 13

PostPosted: Mon Jun 11, 2007 10:36 am    Post subject: Reply with quote

Im afraid I dont know about any HTTP module... Do you have a tutorial somewhere?
Back to top
View user's profile Send private message
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Mon Jun 11, 2007 12:38 pm    Post subject: Reply with quote

Search the forum for examples.
_________________
Follow me on GitHub

- Opposing

Public Tcl scripts
Back to top
View user's profile Send private message Visit poster's website
rosc2112
Revered One


Joined: 19 Feb 2006
Posts: 1454
Location: Northeast Pennsylvania

PostPosted: Mon Jun 11, 2007 4:01 pm    Post subject: Reply with quote

The http package is well documented in the tcl man pages.. There's also a thousand example scripts here and in the archives (all of my webscripts use the http package, a few use the socket code, none use egghttp.tcl)
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