| View previous topic :: View next topic |
| Author |
Message |
Dark_Lancer Voice
Joined: 01 Mar 2006 Posts: 4
|
Posted: Wed Mar 01, 2006 2:29 pm Post subject: Help: Topic -> PHP via URL-Call [Solved] |
|
|
hi @ all
for first excuse my bad english. I'm very new in the TCL programming and I got a few Problems with my Windrop-Script.
Before I write down my code, here what I want the Script/Bot to do.
The Bot is sitting in a channel and wait for Topic-changes. If the Topic was changed he should catch it, build an URL to submit it to a PHP-module an makes an Simple URL-call. I got everything to work, only the URL-Call will not work. I added 2 "putlog"'s to see if the topic was catched correctly and if the http::formatQuery builds the end of the URL in the rigt way. Following my actual Script-Code.
| Code: |
bind topc - * catch_topic
package require http
proc catch_topic {nick uhost handle chan topic} {
global botnick url chantopic
if {$chan == "#d2nsa.bt"} then {
set chantopic [topic #d2nsa.bt]
set ::http(-useragent) {Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)}
set url [::http::formatQuery "type" "topic" "info" $chantopic]
set token [::http::geturl "http://www.allytool.d2nsa.de/submit.php" -query $url -timeout 5000]
putlog "$url"
::http::cleanup $token
putlog "New topic: d2nsa.bt $chantopic"
}
}
|
The URL i need to call look like this :
| Code: |
http://www.allytool.d2nsa.de/submit.php?type=topic&info=$chantopic
|
Everythings works in an Test-channel, i get when I'm in a DCC-Chat with the Bot, the correct putlogs, but the logger for the PHP-modul shows me no URL-Call. Where s my mistake?
And there is another Question for me. The Topic in the Original Channel is Colored. When the Bot catch this i get an Error. I don't remember the complete Message, but it was like " Invalid Url". in the Putlog I see the coplete colored Topic. How can I strip the Colors out of the topic?
I know, these are a lot of questions, but maybe someone can help me.
Greets
Dark_Lancer |
|
| Back to top |
|
 |
demond Revered One

Joined: 12 Jun 2004 Posts: 3073 Location: San Francisco, CA
|
Posted: Thu Mar 02, 2006 1:09 am Post subject: |
|
|
don't use the -query switch, it does POST and you need GET; so concatenate the result of [formatQuery] with your submit URL
see tcl-commands.doc for color-stripping proc; you can also use this:
| Code: |
regsub -all {([\002\017\026\037]|[\003]{1}[0-9]{0,2}[\,]{0,1}[0-9]{0,2})} $text {} text
|
_________________ connection, sharing, dcc problems? click <here>
before asking for scripting help, read <this>
use [code] tag when posting logs, code |
|
| Back to top |
|
 |
Dark_Lancer Voice
Joined: 01 Mar 2006 Posts: 4
|
Posted: Thu Mar 02, 2006 5:46 am Post subject: |
|
|
Hi demond,
i made the changes you mentioned.
the part looks now like this:
| Code: |
if {$chan == "#d2nsa.bt"} then {
set temptopic [topic #d2nsa.bt]
set ::http(-useragent) {Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)}
regsub -all {([\002\017\026\037]|[\003]{1}[0-9]{0,2}[\,]{0,1}[0-9]{0,2})} $temptopic {} chantopic
set turl [::http::formatQuery "type" "topic" "info" $chantopic]
set url "http://www.allytool.d2nsa.de/submit.php?$turl"
set token [::http::geturl $url -timeout 10000]
set status [::http::status $token]
putlog "URL : $url"
putlog "Status : $status"
::http::cleanup $token
putlog "New topic: d2nsa.bt $chantopic"
}
|
The Putlog shows me the correct url now
| Code: |
URL : http://www.allytool.d2nsa.de/submit.php?type=topic&info=test2
|
but the putlog of $status gives me only a timeout
what i don't understand is, why i don't get the url-call showed in the PHP-logger. Could it be, because I'm sitting behind a proxy-server? Or do I need an other TCL-version or http.tcl?
Here the infos i got from windrop on startup
| Code: |
Eggdrop v1.6.17 (C) 1997 Robey Pointer (C) 2004 Eggheads
[08:49] --- Loading eggdrop v1.6.17 (Thu Mar 2 2006)
[08:49] Modul geladen: dns
[08:49] Modul geladen: channels
[08:49] Modul geladen: server
[08:49] Modul geladen: ctcp
[08:49] Modul geladen: irc
[08:49] Modul geladen: notes (mit Sprach-Unterstuetzung)
[08:49] Modul geladen: console (mit Sprach-Unterstuetzung)
[08:49] Modul geladen: blowfish
[08:49] Modul geladen: uptime
[08:49] Script loaded: Catch_topics
[08:49] Userinfo TCL v1.07 loaded (URL BF GF IRL EMAIL DOB PHONE ICQ).
[08:49] use '.help userinfo' for commands.
[08:49] Identd: I don't know why you're using winident.tcl on your system, but i
t probably won't work on anything but Windows.
[08:49] winident.tcl v1.2 - by FireEgl@EFNet <FireEgl@Windrop.cjb.net> - Loaded.
[08:49] Userfile loaded, unpacking... |
I think i'm gonna look for a newer TCL version. |
|
| Back to top |
|
 |
demond Revered One

Joined: 12 Jun 2004 Posts: 3073 Location: San Francisco, CA
|
Posted: Fri Mar 03, 2006 2:32 am Post subject: |
|
|
try to connect to your webserver from your shell via telnet on port 80
if you are unable to, so is your bot _________________ connection, sharing, dcc problems? click <here>
before asking for scripting help, read <this>
use [code] tag when posting logs, code |
|
| Back to top |
|
 |
Dark_Lancer Voice
Joined: 01 Mar 2006 Posts: 4
|
Posted: Fri Mar 03, 2006 8:31 am Post subject: |
|
|
ok, i tried to connect via telnet, and it doesn't work.
How can I "recode" the script for Proxy use? In the Internet-options of internet-Explorer i have the settings for http/secure/ftp/gopher -proxy servers. http for example runs over port 8000.
Edit:
i think i found it.
http://tmml.sourceforge.net/doc/tcl/http.html
the http::config section, i think. i will try it on Monday |
|
| Back to top |
|
 |
Dark_Lancer Voice
Joined: 01 Mar 2006 Posts: 4
|
Posted: Mon Mar 06, 2006 3:45 am Post subject: |
|
|
so, i tried it.
and it works.
Thx for the help demond.
thread can be closed or [solved]  |
|
| Back to top |
|
 |
|
|
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
|
|