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 again - [SOLVED] (used a different method)

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


Joined: 24 Mar 2004
Posts: 75
Location: Lebanon

PostPosted: Wed Jun 14, 2006 5:46 pm    Post subject: egghttp again - [SOLVED] (used a different method) Reply with quote

hi there

i've written the following script :
Code:

bind pub - !bleh  check_page

proc check_page {nick uhost handle chan arg} {

   puthelp "privmsg #bleh : ***************getting page"
   set sock [egghttp:geturl www.whatismyip.org/ get_score]
   puthelp "privmsg #bleh : ***************finished page"
}

proc get_score {sock} {

   puthelp "privmsg #bleh : entered get_score"
   set buffer [egghttp:data $sock]
   puthelp "privmsg #bleh : $sock"
   puthelp "privmsg #bleh : $buffer"
   
   egghttp:cleanup $sock
   set x 0
   foreach line [split $buffer "\n"] {
               inc x 1
               puthelp "PRIVMSG #bleh : $x $line"
   }
   puthelp "privmsg #bleh : left get_score"
}


when i trigger it, i get the following:

Quote:

[21:32] <@Reverence> ***************getting page
[21:32] <@Reverence> ***************finished page
[21:32] <@Reverence> entered get_score
[21:32] <@Reverence> 9
[21:32] <@Reverence>
[21:32] <@Reverence> left get_score


any idea why the data gotten is empty?
thanks.


Last edited by SaPrOuZy on Mon Jun 19, 2006 3:18 am; edited 1 time in total
Back to top
View user's profile Send private message
De Kus
Revered One


Joined: 15 Dec 2002
Posts: 1361
Location: Germany

PostPosted: Thu Jun 15, 2006 4:11 am    Post subject: Reply with quote

Nope, sorry:
Quote:
~$ telnet www.whatismyip.org 80
Trying 206.176.224.3...
Connected to am3.am.net.
Escape character is '^]'.
GET / HTTP/1.0

HTTP/1.0 200 OK
MIME-Version: 1.0
Date: Thu, 15 Jun 2006 08:10:42 GMT
Server: AOLserver/4.0
Content-Type: text/plain
Content-Length: 11
Connection: close

208.98.**.**Connection closed by foreign host.
~$

_________________
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
View user's profile Send private message MSN Messenger
SaPrOuZy
Halfop


Joined: 24 Mar 2004
Posts: 75
Location: Lebanon

PostPosted: Thu Jun 15, 2006 4:15 am    Post subject: Reply with quote

so the problem isn't in the code?
i tried it initially on a different site (www.livescore.com)
with the same outcome.
that's why i thought it was from the code
Back to top
View user's profile Send private message
user
 


Joined: 18 Mar 2003
Posts: 1452
Location: Norway

PostPosted: Thu Jun 15, 2006 8:47 am    Post subject: Reply with quote

egghttp looks for a "<" to locate the "body" of the http response... you'll have to change the output of the site to include a "<" or alter the way egghttp locates the end of the header. (all header fields (should) start with a single word that ends with a ":") Make strikelight fix it Wink
_________________
Have you ever read "The Manual"?
Back to top
View user's profile Send private message
SaPrOuZy
Halfop


Joined: 24 Mar 2004
Posts: 75
Location: Lebanon

PostPosted: Thu Jun 15, 2006 8:54 am    Post subject: Reply with quote

but livescore.com is a normal site with normal http code.
anyways thanks for the info, i'll try to change egghttp to give me everything and i'll deal with the dump my self.
Back to top
View user's profile Send private message
user
 


Joined: 18 Mar 2003
Posts: 1452
Location: Norway

PostPosted: Thu Jun 15, 2006 3:47 pm    Post subject: Reply with quote

SaPrOuZy wrote:
but livescore.com is a normal site with normal http code.
anyways thanks for the info, i'll try to change egghttp to give me everything and i'll deal with the dump my self.

There's nothing wrong with the http part...it's the part of egghttp dealing with the content that expects markup...your ip is probably the last line of [egghttp:headers $sock], so try
Code:
[lindex [split [egghttp:headers $sock] \n] end]
...but i still think strikelight should make some changes to his script Smile (i've sent him a PM about it)
_________________
Have you ever read "The Manual"?
Back to top
View user's profile Send private message
SaPrOuZy
Halfop


Joined: 24 Mar 2004
Posts: 75
Location: Lebanon

PostPosted: Thu Jun 15, 2006 3:55 pm    Post subject: Reply with quote

thx for ur reply.
my main issue is not getting my ip Razz
it was just an example that i tried.
what am trying is to get http://www.livescore.com
am making a script to get world cup matches scores and post them on the channel.

egghttp worked with other sites, but it seems it's not owrking with livescore.com the data i get is empty.

anyway now am going to try to exec a wget on the site , rename the file , and work on the file Very Happy hehe
Back to top
View user's profile Send private message
user
 


Joined: 18 Mar 2003
Posts: 1452
Location: Norway

PostPosted: Thu Jun 15, 2006 4:03 pm    Post subject: Reply with quote

SaPrOuZy wrote:
but livescore.com is a normal site with normal http code.
anyways thanks for the info, i'll try to change egghttp to give me everything and i'll deal with the dump my self.

You should have said so in the first place...what happens when you fetch livescore.com using your script? (it seems most of the content is on a single line - which would be impossible to transmit in a single PRIVMSG)
btw: the markup on that page sucks - have fun parsing it Twisted Evil
_________________
Have you ever read "The Manual"?
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