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 

download a html file

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
BlinK_
Voice


Joined: 18 Nov 2005
Posts: 4

PostPosted: Fri Nov 18, 2005 12:18 pm    Post subject: download a html file Reply with quote

Hello. How to download a file, in ex: http://somesite.some/somefile.html to the eggdrop dir. Later i want to extract some notes from it. But i asume learning how to download it wuold be a best start.. Thank you.
Back to top
View user's profile Send private message
]Kami[
Owner


Joined: 24 Jul 2003
Posts: 590
Location: Slovenia

PostPosted: Fri Nov 18, 2005 12:41 pm    Post subject: Reply with quote

Well, you could do it with shell command, but u need to have wget installed Razz

Code:
catch {exec wget http://somesite.some/somefile.html}
file rename -force somefile.html /home/you/eggdrop/somefile.html

_________________
Slovene Eggdrop Page
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
rayman
Voice


Joined: 18 Nov 2005
Posts: 4
Location: Germany

PostPosted: Fri Nov 18, 2005 12:45 pm    Post subject: Reply with quote

Or you can use lynx (if installed)

Code:
exec lynx -dump http://www.somesite.com/somepage.html >somefile.tmp


Greetz
rayman
Back to top
View user's profile Send private message
demond
Revered One


Joined: 12 Jun 2004
Posts: 3073
Location: San Francisco, CA

PostPosted: Sat Nov 19, 2005 12:05 am    Post subject: Reply with quote

neither of these will work on Windows (windrop), nor will they help you later in parsing

you should use Tcl's built-in http package:
Code:

package require http
set token [::http::geturl http://foo.com/bar.html]
# save it to file
set f [open bar.html w]
fconfigure $f -translation binary
puts -nonewline $f [::http::data $token]
close $f
# or parse it
foreach line [split [::http::data $token] \n] {
   # parse that line
}
::http::cleanup $token

_________________
connection, sharing, dcc problems? click <here>
before asking for scripting help, read <this>
use [code] tag when posting logs, code
Back to top
View user's profile Send private message Visit poster's website
BlinK_
Voice


Joined: 18 Nov 2005
Posts: 4

PostPosted: Sat Nov 19, 2005 4:47 am    Post subject: Reply with quote

thank you for help. Will demonds script overwrite bar.html file if it already exist?

And i get an error while running this script in tclpro :

http://k.1asphost.com/pbatm/error.jpg

And i want to do a Half life server browser dcript. So i know the website witch gives information of specified servers. So i download html file to the eggdrop dir. Extract some info. And post it to the chan. Maybe there is some easyer way to do this? Maybe there is some scripts already done? I searched this tcl archive and found nothing. Then I googled a lot.. And still nothing...
Back to top
View user's profile Send private message
demond
Revered One


Joined: 12 Jun 2004
Posts: 3073
Location: San Francisco, CA

PostPosted: Sat Nov 19, 2005 6:28 am    Post subject: Reply with quote

not a script problem, your installation's problem

learn to copy & paste text, no need to post pictures of text; and learn how to use http package (I somehow doubt you have any experience in scripting though...)

there are zillions of http scripts which do what you want to do; how did your search yield nothing is beyond me
_________________
connection, sharing, dcc problems? click <here>
before asking for scripting help, read <this>
use [code] tag when posting logs, code
Back to top
View user's profile Send private message Visit poster's website
BlinK_
Voice


Joined: 18 Nov 2005
Posts: 4

PostPosted: Sat Nov 19, 2005 7:29 am    Post subject: Reply with quote

of course i have no exp in tcl scripting. that is why i'm asking help.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help 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