| View previous topic :: View next topic |
| Author |
Message |
MacDaddy Voice
Joined: 20 Jan 2006 Posts: 9
|
Posted: Wed Nov 01, 2006 5:52 am Post subject: search help |
|
|
hey all i cant get this to work no matter what i try
what i need is for it to add the arg to the url but it only adds
eg !search MacDaddy works.
but !search MacDaddy IRC it dont see the IRC part
| Code: |
bind pub - !search pub:search
proc pub:search {n u h c a} {
set text [lindex [split $a] 0]
if { [string match "" "$a"] } {
puthelp "PRIVMSG $c $n :usage: !search UserName"
} else {
set data [::http::geturl http://www.mydomain.com/test/ircstats.php?search=$text]
foreach line [split [::http::data $data] \n] {
puthelp "PRIVMSG $c :Retrieving User Data.... Please Wait...."
puthelp "PRIVMSG $c :$line"
}
::http::cleanup $data
}
}
|
it needs to send the full arg to the php not just the first word
thanks for anyhelp  |
|
| Back to top |
|
 |
r0t3n Owner
Joined: 31 May 2005 Posts: 507 Location: UK
|
Posted: Wed Nov 01, 2006 6:40 am Post subject: |
|
|
Try:
| Code: | bind pub - !search pub:search
proc pub:search {n u h c a} {
if {$a == ""} {
puthelp "PRIVMSG $c :usage: !search UserName"
} else {
set data [::http::geturl http://www.mydomain.com/test/ircstats.php?search=$a]
foreach line [split [::http::data $data] \n] {
puthelp "PRIVMSG $c :Retrieving User Data.... Please Wait...."
puthelp "PRIVMSG $c :$line"
}
::http::cleanup $data
}
} |
_________________ r0t3n @ #r0t3n @ Quakenet |
|
| Back to top |
|
 |
MacDaddy Voice
Joined: 20 Jan 2006 Posts: 9
|
Posted: Wed Nov 01, 2006 6:52 am Post subject: |
|
|
| Tosser^^ wrote: | Try:
| Code: | bind pub - !search pub:search
proc pub:search {n u h c a} {
if {$a == ""} {
puthelp "PRIVMSG $c :usage: !search UserName"
} else {
set data [::http::geturl http://www.mydomain.com/test/ircstats.php?search=$a]
foreach line [split [::http::data $data] \n] {
puthelp "PRIVMSG $c :Retrieving User Data.... Please Wait...."
puthelp "PRIVMSG $c :$line"
}
::http::cleanup $data
}
} |
|
Tryed that before i get no reply and no error from the bot.
also tryed :
| Code: |
bind pub - !search pub:search
proc pub:search {n u h c a} {
set text [lindex [split $a] 0]
set text2 [lindex [split $a] 1]
if { [string match "" "$a"] } {
puthelp "PRIVMSG $c $n :usage: !search UserName"
} else {
set data [::http::geturl http://www.mydomain.com/test/ircstats.php?search=$text$text2]
foreach line [split [::http::data $data] \n] {
puthelp "PRIVMSG $c :Retrieving User Data.... Please Wait...."
puthelp "PRIVMSG $c :$line"
}
::http::cleanup $data
}
}
|
that just gives whatever you type eg MacDaddy IRC
will become MacDaddyIRC
if i put $a in
puthelp "PRIVMSG $c :Retrieving Data For $a.... Please Wait...."
it sees the MacDaddy IRC just dont send it |
|
| Back to top |
|
 |
rosc2112 Revered One

Joined: 19 Feb 2006 Posts: 1454 Location: Northeast Pennsylvania
|
Posted: Wed Nov 01, 2006 7:47 am Post subject: |
|
|
| Instead of lindex junk, regsub the space with either %20 or %2B (+ sign) depending on what the website wants for spaces.. |
|
| Back to top |
|
 |
rosc2112 Revered One

Joined: 19 Feb 2006 Posts: 1454 Location: Northeast Pennsylvania
|
Posted: Wed Nov 01, 2006 7:50 am Post subject: |
|
|
And what is the point of
if { [string match "" "$a"] } {
when you can just do
if {$a == ""} |
|
| Back to top |
|
 |
metroid Owner
Joined: 16 Jun 2004 Posts: 771
|
Posted: Wed Nov 01, 2006 3:04 pm Post subject: |
|
|
You need to encode the URL.
You can make your own proc to do it. |
|
| Back to top |
|
 |
MacDaddy Voice
Joined: 20 Jan 2006 Posts: 9
|
Posted: Wed Nov 01, 2006 5:40 pm Post subject: |
|
|
| rosc2112 wrote: | And what is the point of
if { [string match "" "$a"] } {
when you can just do
if {$a == ""} |
| Quote: | | Instead of lindex junk, regsub the space with either %20 or %2B (+ sign) depending on what the website wants for spaces.. |
thanks that was it needed the %20 works great
if {$a == ""} <<-- dont work
Tcl error [pub:torrent]: wrong # args: no script following "{$a == ""}" argument |
|
| Back to top |
|
 |
rosc2112 Revered One

Joined: 19 Feb 2006 Posts: 1454 Location: Northeast Pennsylvania
|
Posted: Wed Nov 01, 2006 6:22 pm Post subject: |
|
|
The format of if is:
if {test} {do stuff}
So yeah, if {test} would not work by itself. |
|
| Back to top |
|
 |
|