| View previous topic :: View next topic |
| Author |
Message |
.pt Halfop
Joined: 16 Nov 2005 Posts: 71
|
Posted: Thu May 25, 2006 2:25 pm Post subject: read .txt from web |
|
|
i got a .txt on a website with just 1 line and i want the bot to read that line when i do a command, can someone make that pls
tks in advance, best regards |
|
| Back to top |
|
 |
DragnLord Owner

Joined: 24 Jan 2004 Posts: 711 Location: C'ville, Virginia, USA
|
Posted: Thu May 25, 2006 2:43 pm Post subject: |
|
|
something along this line
| Code: | package require http
set url "http://your.site/page.html"
bind pub - !command web:read
proc web:read {n u h c t} {
::http::config -useragent "Mozilla/4.75 (X11; U; FreeBSD 6.1; i586; Nav)"
set http [::http::data [::http::geturl $url]]
putserv "PRIVMSG $c $http"
} |
|
|
| Back to top |
|
 |
.pt Halfop
Joined: 16 Nov 2005 Posts: 71
|
Posted: Thu May 25, 2006 6:46 pm Post subject: |
|
|
i get this error
Tcl error [web:read]: canīt read "url": no suck variable |
|
| Back to top |
|
 |
DragnLord Owner

Joined: 24 Jan 2004 Posts: 711 Location: C'ville, Virginia, USA
|
Posted: Thu May 25, 2006 7:29 pm Post subject: |
|
|
| Code: | package require http
set weburl "http://your.site/page.html"
bind pub - !command web:read
proc web:read {n u h c t} {
::http::config -useragent "Mozilla/4.75 (X11; U; FreeBSD 6.1; i586; Nav)"
set http [::http::data [::http::geturl $::weburl]]
putserv "PRIVMSG $c $http"
} |
|
|
| Back to top |
|
 |
.pt Halfop
Joined: 16 Nov 2005 Posts: 71
|
Posted: Fri May 26, 2006 9:02 am Post subject: |
|
|
| same thing, my url ends in .txt and not in html.. maybe thats why? |
|
| Back to top |
|
 |
De Kus Revered One

Joined: 15 Dec 2002 Posts: 1361 Location: Germany
|
Posted: Fri May 26, 2006 9:57 am Post subject: |
|
|
your url must now be a weburl (check var names) . _________________ De Kus
StarZ|De_Kus, De_Kus or DeKus on IRC
Copyright Đ 2005-2009 by De Kus - published under The MIT License
Love hurts, love strengthens... |
|
| Back to top |
|
 |
user

Joined: 18 Mar 2003 Posts: 1452 Location: Norway
|
Posted: Fri May 26, 2006 10:08 am Post subject: |
|
|
you should invoke ::http::cleanup at the end of your proc (check the manual for details) _________________ Have you ever read "The Manual"? |
|
| Back to top |
|
 |
NTHosts Op
Joined: 10 Oct 2005 Posts: 100 Location: UK
|
Posted: Fri May 26, 2006 11:18 am Post subject: ... |
|
|
If not try this, always worked for me
| Code: |
package require http
bind pub - !test foo
proc foo {n u h c t} {
set x [::http::geturl http://bar.com/moo.txt]
foreach e [split [::http::data $x] \n] {puthelp "privmsg $c :$e"}
::http::cleanup $x
}
|
_________________ www.NT-Hosts.Net - More than just a host |
|
| Back to top |
|
 |
|