egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

read .txt from web

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
.pt
Halfop


Joined: 16 Nov 2005
Posts: 71

PostPosted: Thu May 25, 2006 2:25 pm    Post subject: read .txt from web Reply with quote

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
View user's profile Send private message
DragnLord
Owner


Joined: 24 Jan 2004
Posts: 711
Location: C'ville, Virginia, USA

PostPosted: Thu May 25, 2006 2:43 pm    Post subject: Reply with quote

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
View user's profile Send private message
.pt
Halfop


Joined: 16 Nov 2005
Posts: 71

PostPosted: Thu May 25, 2006 6:46 pm    Post subject: Reply with quote

i get this error

Tcl error [web:read]: canīt read "url": no suck variable
Back to top
View user's profile Send private message
DragnLord
Owner


Joined: 24 Jan 2004
Posts: 711
Location: C'ville, Virginia, USA

PostPosted: Thu May 25, 2006 7:29 pm    Post subject: Reply with quote

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
View user's profile Send private message
.pt
Halfop


Joined: 16 Nov 2005
Posts: 71

PostPosted: Fri May 26, 2006 9:02 am    Post subject: Reply with quote

same thing, my url ends in .txt and not in html.. maybe thats why?
Back to top
View user's profile Send private message
De Kus
Revered One


Joined: 15 Dec 2002
Posts: 1361
Location: Germany

PostPosted: Fri May 26, 2006 9:57 am    Post subject: Reply with quote

your url must now be a weburl (check var names) Razz.
_________________
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
View user's profile Send private message MSN Messenger
user
 


Joined: 18 Mar 2003
Posts: 1452
Location: Norway

PostPosted: Fri May 26, 2006 10:08 am    Post subject: Reply with quote

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
View user's profile Send private message
NTHosts
Op


Joined: 10 Oct 2005
Posts: 100
Location: UK

PostPosted: Fri May 26, 2006 11:18 am    Post subject: ... Reply with quote

If not try this, always worked for me Smile

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
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
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


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber