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.
Spirit
Voice
Posts: 15 Joined: Sat Oct 11, 2003 5:57 am
Post
by Spirit » Sat Oct 11, 2003 6:06 am
Hi @ll!
I got a php-site, which searches a mysql-db and sends me the results as simple text back.
Is it possible to connect with the eggdrop to the page, get the results and post them into a channel?
The URL looks like this:
http://www.website.com/ircquery.php?pas ... ch¶m=B
And the results are looking like this:
Bad Boy
Bomber
...
It makes a "B*" search in the database.
it's not a bug - it's a feature!
Papillon
Owner
Posts: 724 Joined: Fri Feb 15, 2002 8:00 pm
Location: *.no
Post
by Papillon » Sat Oct 11, 2003 8:33 am
Code: Select all
set result [::http::data [set tok [::http::geturl http://www.website.com/ircquery.php?pass=secret&select=search¶m=B]]]
::http::cleanup $tok
#$result conatins the results
Elen sila lúmenn' omentielvo
Spirit
Voice
Posts: 15 Joined: Sat Oct 11, 2003 5:57 am
Post
by Spirit » Sat Oct 11, 2003 9:15 am
Thx Papillon!
Unfortuantely i am not getting any results back. Just for the testing i am posting the results in a dummychan right away.
Code: Select all
proc pub_!getresult {nick uhost hand chan rest} {
set result [::http::data [set tok [::http::geturl http://www.website.com/ircquery.php?pass=secret&select=search¶m=B]]]
putchan $chan $result
::http::cleanup $tok
}
bind pub - !getresult pub_!getresult
The bot is posting, when i fill $result by hand and i get results when i enter the URL in the IE
it's not a bug - it's a feature!
GodOfSuicide
Master
Posts: 463 Joined: Mon Jun 17, 2002 8:00 pm
Location: Austria
Post
by GodOfSuicide » Sat Oct 11, 2003 10:49 am
is there an error on the partyline ?
and : have you loaded egghttp.tcl ?
Spirit
Voice
Posts: 15 Joined: Sat Oct 11, 2003 5:57 am
Post
by Spirit » Sat Oct 11, 2003 11:02 am
Yep ..egghttp.tcl is loaded, but after your post
Didn't know i need that script *sorry*
Now there is a error:
Code: Select all
Tcl error [pub_!getresult]: invalid command name "::http::geturl"
it's not a bug - it's a feature!
GodOfSuicide
Master
Posts: 463 Joined: Mon Jun 17, 2002 8:00 pm
Location: Austria
Post
by GodOfSuicide » Sat Oct 11, 2003 11:18 am
i dont work that much with http scripts, but try using the egghttp:geturl proc instead
Spirit
Voice
Posts: 15 Joined: Sat Oct 11, 2003 5:57 am
Post
by Spirit » Sat Oct 11, 2003 1:15 pm
Ok now i get a little further (by using the egghttp.tcl), and there is always this message:
Code: Select all
net: connect! sock 6
net: eof!(read) socket 6
by using this code:
Code: Select all
proc pub_!bsd {nick uhost hand chan rest} {
set sock [egghttp:geturl http://www.website.com/ircquery.php?pass=secret&select=search¶m=B get_results]
}
bind pub - !bsd pub_!bsd
proc get_results {sock} {
set buffer [egghttp:data $sock]
egghttp:cleanup $sock
putlog $buffer
}
I used the example at the end of the script and made sure, that there are any results
it's not a bug - it's a feature!
egghead
Master
Posts: 481 Joined: Mon Oct 29, 2001 8:00 pm
Contact:
Post
by egghead » Sat Oct 11, 2003 1:18 pm
Papillon gave the code snippet, so he may want to answer the question. But likely you need to use http.tcl that ships with tcl (directory http2.4).
Spirit
Voice
Posts: 15 Joined: Sat Oct 11, 2003 5:57 am
Post
by Spirit » Sat Oct 11, 2003 1:45 pm
Thx alot egghead!!
I didnt know, where to find that tcl. I used tho old code from Papillon and now it works
)
Thx all for your help!
it's not a bug - it's a feature!