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.
Old posts that have not been replied to for several years.
Astatine
Voice
Posts: 3 Joined: Sun Dec 19, 2004 12:18 pm
Post
by Astatine » Sun Dec 19, 2004 12:22 pm
Hi all, I need help writing a very simple script. It needs to take a pubic msg from a channel that specifies an id number (such as !id 999) and then grab the contents of a page (such as
www.domain.com/content.php?id=999 ) and display it. The id number will change and the output of the web page can be very bare, just the needed data. Can someone help me with this? Thanks.
demond
Revered One
Posts: 3073 Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:
Post
by demond » Sun Dec 19, 2004 12:42 pm
Code: Select all
package require http
bind pub - !id foo
proc foo {n u h c t} {
set t [::http::geturl http://www.domain.com/content.php?id=$t]
foreach line [split [::http::data $t] \n] {puthelp "privmsg $c :$line"}
::http::cleanup $t
}
you might want to add some error checking to this
Astatine
Voice
Posts: 3 Joined: Sun Dec 19, 2004 12:18 pm
Post
by Astatine » Sun Dec 19, 2004 1:29 pm
Thanks, it works perfectly.
DJ-X-Ray133
Voice
Posts: 4 Joined: Tue Jan 04, 2005 2:19 pm
Post
by DJ-X-Ray133 » Tue Jan 04, 2005 2:23 pm
Hi,
I wrote a Script in PHP on my Webserver.
The content of this script changes often a day.
I need a script that gets the content only when its requestet by !foo in a channel. How can i do this???
Does your Script do this demond?
Thank you,
Dj-X-Ray133
demond
Revered One
Posts: 3073 Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:
Post
by demond » Tue Jan 04, 2005 6:16 pm
try it, changing the URL to yours
DJ-X-Ray133
Voice
Posts: 4 Joined: Tue Jan 04, 2005 2:19 pm
Post
by DJ-X-Ray133 » Tue Jan 04, 2005 8:57 pm
It seems to work great, thank you.
But some people in my channel don't like bots so i decided to let him act by msg and not by public requests. But when I msg the !command the console says:
[01:55] Tcl error [today]: wrong # args: should be "today n u h c t"
how can i fix it?
demond
Revered One
Posts: 3073 Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:
Post
by demond » Tue Jan 04, 2005 9:17 pm
Code: Select all
package require http
bind msg - cmd foo
proc foo {n u h t} {
set t [::http::geturl http://yourURL]
foreach line [split [::http::data $t] \n] {puthelp "notice $n :$line"}
::http::cleanup $t
}
DJ-X-Ray133
Voice
Posts: 4 Joined: Tue Jan 04, 2005 2:19 pm
Post
by DJ-X-Ray133 » Wed Jan 05, 2005 11:33 am
Thank you very much it works perfect. But how can I use two or more arguments vor the website like $t???
Sry, i dont like tcl much, i'd like a php module for eggdrop ^^
Cya, Dj-X-Ray133
demond
Revered One
Posts: 3073 Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:
Post
by demond » Sat Jan 08, 2005 10:28 am
Code: Select all
package require http
bind msg - cmd foo
proc foo {n u h t} {
set foo1 [lindex [split $t] 0]
set foo2 [lindex [split $t] 1]
set t [::http::geturl http://foo.org/foo.php?foo1=${foo1}&foo2=${foo2}]
foreach line [split [::http::data $t] \n] {puthelp "notice $n :$line"}
::http::cleanup $t
}