| View previous topic :: View next topic |
| Author |
Message |
NTHosts Op
Joined: 10 Oct 2005 Posts: 100 Location: UK
|
Posted: Fri Jun 09, 2006 11:11 am Post subject: egghttp please help :) |
|
|
Ok I have written this...
| Code: |
set url "$ip:$port/admin.cgi?mode=viewxml"
set djtrigger "!dj"
set ip "lynxfm.com"
set port "9004"
set pass "whatever"
set channel "#botchan"
if {![info exists egghttp(version)]} {
putlog "egghttp.tcl was NOT successfully loaded."
putlog "shoutcast.tcl has not been loaded as a result."
} else {
proc current_dj {sock} {
global channel
set headers [egghttp:headers $sock]
set body [egghttp:data $sock]
regexp { <SERVERTITLE>(.*)</SERVERTITLE> } $body - dj
putquick "PRIVMSG $channel :\0032The current DJ is: \0034 $dj"
}
bind pub -|* $djtrigger top:djtrigger
proc top:djtrigger {nick host hand chan text} {
global url
set sock [egghttp:geturl $url current_dj]
return 1
}
}
|
But.. I dont know how to log into the page to parse the onfo I need so not even sure if the
set url "whatitsaysupthere"
will work with the
set ip "bleah"
set port "bleahsomemore"
as you can see i have... set pass "whatever"
But how can I get egghttp use that in the http login form with also the username admin.
I have looked through the egghttp docs but dont see anything that tells you about login forms.
Any suggestions please ?  _________________ www.NT-Hosts.Net - More than just a host |
|
| Back to top |
|
 |
NTHosts Op
Joined: 10 Oct 2005 Posts: 100 Location: UK
|
Posted: Fri Jun 09, 2006 4:18 pm Post subject: ... |
|
|
Ok I tried scrapping using egghttp and use sockets.. I came up with this...
| Code: |
bind pub -|- !dj curdj
set server "lynxfm.com"
set port "9004"
set pass "demo"
proc curdj {nick host handle chan text} {
global server port pass
if {[catch {set sock [socket $server $port] } sockerror]} {
putlog "error: $sockerror"
return 0 } else {
puts $sock "GET /admin.cgi?pass=$pass&mode=viewxml&page=0 HTTP/1.0"
puts $sock "User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.9)"
puts $sock "Host: $server"
puts $sock "Connection: close"
puts $sock ""
flush $sock
while {[eof $sock] != 1} {
regexp { <SERVERTITLE>(.*)</SERVERTITLE> } $body - dj
}
putquick "PRIVMSG $channel :\0032The current DJ is: \0034 $dj"
close $sock
}}
|
But it cant open the connection for some reason
Nick .set errorInfo
TCLTestBot [15:17] #Nick# set errorInfo
TCLTestBot Currently: couldn't open socket: host is unreachable
TCLTestBot Currently: while executing
TCLTestBot Currently: "socket $server $port"
My head hurts lol.. any help plz ?  _________________ www.NT-Hosts.Net - More than just a host |
|
| Back to top |
|
 |
De Kus Revered One

Joined: 15 Dec 2002 Posts: 1361 Location: Germany
|
Posted: Fri Jun 09, 2006 8:23 pm Post subject: |
|
|
verify you can connect to that host from your shell. Maybe its firewalled. _________________ De Kus
StarZ|De_Kus, De_Kus or DeKus on IRC
Copyright © 2005-2009 by De Kus - published under The MIT License
Love hurts, love strengthens... |
|
| Back to top |
|
 |
NTHosts Op
Joined: 10 Oct 2005 Posts: 100 Location: UK
|
Posted: Sat Jun 10, 2006 4:36 pm Post subject: ... |
|
|
Nope its all run from my own server, so no firewall  _________________ www.NT-Hosts.Net - More than just a host |
|
| Back to top |
|
 |
De Kus Revered One

Joined: 15 Dec 2002 Posts: 1361 Location: Germany
|
Posted: Tue Jun 13, 2006 6:48 am Post subject: |
|
|
then maybe your routing table is improper? Just beeing it your server doesnt exclude the reason of failure to be an iptables/ipchain setting... or simply refered as "firewall and routing rules". All you can do is making sure that the IP it tries to connect is valid. Try to set debug code to show you to what it actually tries to connect and verify it can connect to it outside of the bot, because only then it would be an issue with eggdrop ^.^.
Maybe socket binds to the wrong interface(s), try using the -myaddr option. _________________ De Kus
StarZ|De_Kus, De_Kus or DeKus on IRC
Copyright © 2005-2009 by De Kus - published under The MIT License
Love hurts, love strengthens... |
|
| Back to top |
|
 |
|