This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Help with egghttp.tcl

Old posts that have not been replied to for several years.
Locked
M
Monty_
Voice
Posts: 23
Joined: Wed May 19, 2004 11:51 pm

Help with egghttp.tcl

Post by Monty_ »

When attempting to retrieve a web page, I get the following error:

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"><HTML><HEAD><TITLE>400 Bad Request</TITLE></HEAD><BODY><H1>Bad Request</H1>Your browser sent a request that this server could not understand.<P>Invalid URI in request GET HTTP/2.0<P><HR><ADDRESS>Apache/1.3.27 Server at www.humorscope.com Port 80</ADDRESS></BODY></HTML>

Does anyone understand this, and even better, know what's wrong?

Thanks
User avatar
strikelight
Owner
Posts: 708
Joined: Mon Oct 07, 2002 10:39 am
Contact:

Post by strikelight »

might help if you posted your script that generated the error
M
Monty_
Voice
Posts: 23
Joined: Wed May 19, 2004 11:51 pm

Post by Monty_ »

Good thinking:

bind pub - !horoscope horoscope

proc horoscope { nick uhost hand chan text } {

set sock [egghttp:geturl http://www.humorscope.com parse_horoscope]
return 1
}

proc parse_horoscope { sock } {
set headers [egghttp:headers $sock]
set body [egghttp:data $sock]
regsub -all "\n" $body "" body
regsub -all -nocase {<br>} $body "<br>\n" body
putserv "privmsg (chan) :$headers"
putserv "privmsg (chan) :$body"
}

The idea is to look at how the HTML comes across so I can decide how to parse it.
User avatar
strikelight
Owner
Posts: 708
Joined: Mon Oct 07, 2002 10:39 am
Contact:

Post by strikelight »

Change:

Code: Select all

set sock [egghttp:geturl http://www.humorscope.com parse_horoscope]
To:

Code: Select all

set sock [egghttp:geturl http://www.humorscope.com/ parse_horoscope]
M
Monty_
Voice
Posts: 23
Joined: Wed May 19, 2004 11:51 pm

Post by Monty_ »

Geez, that's all it took.

Thanks :D
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

Even a missing single character "\" can make an script error and render a script useless.

When we goto a url:

http://www.yahoo.com
http://www.yahoo.com/
www.yahoo.com

For us all would give the same output, however the input is different.
Thats what we sometimes forget, in scripting and coding this is different.

Strikelight is a master in egghttp.tcl and these types of scripts which retreive data from websites and parse them through onto irc channels as privmsgs and notices, so he knows well!
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
Locked