| View previous topic :: View next topic |
| Author |
Message |
SaPrOuZy Halfop

Joined: 24 Mar 2004 Posts: 75 Location: Lebanon
|
Posted: Wed Jun 14, 2006 5:46 pm Post subject: egghttp again - [SOLVED] (used a different method) |
|
|
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 |
|
 |
De Kus Revered One

Joined: 15 Dec 2002 Posts: 1361 Location: Germany
|
Posted: Thu Jun 15, 2006 4:11 am Post subject: |
|
|
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 |
|
 |
SaPrOuZy Halfop

Joined: 24 Mar 2004 Posts: 75 Location: Lebanon
|
Posted: Thu Jun 15, 2006 4:15 am Post subject: |
|
|
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 |
|
 |
user

Joined: 18 Mar 2003 Posts: 1452 Location: Norway
|
Posted: Thu Jun 15, 2006 8:47 am Post subject: |
|
|
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  _________________ Have you ever read "The Manual"? |
|
| Back to top |
|
 |
SaPrOuZy Halfop

Joined: 24 Mar 2004 Posts: 75 Location: Lebanon
|
Posted: Thu Jun 15, 2006 8:54 am Post subject: |
|
|
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 |
|
 |
user

Joined: 18 Mar 2003 Posts: 1452 Location: Norway
|
Posted: Thu Jun 15, 2006 3:47 pm Post subject: |
|
|
| 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 (i've sent him a PM about it) _________________ Have you ever read "The Manual"? |
|
| Back to top |
|
 |
SaPrOuZy Halfop

Joined: 24 Mar 2004 Posts: 75 Location: Lebanon
|
Posted: Thu Jun 15, 2006 3:55 pm Post subject: |
|
|
thx for ur reply.
my main issue is not getting my ip
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 hehe |
|
| Back to top |
|
 |
user

Joined: 18 Mar 2003 Posts: 1452 Location: Norway
|
Posted: Thu Jun 15, 2006 4:03 pm Post subject: |
|
|
| 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  _________________ Have you ever read "The Manual"? |
|
| Back to top |
|
 |
|