| View previous topic :: View next topic |
| Author |
Message |
BlinK_ Voice
Joined: 18 Nov 2005 Posts: 4
|
Posted: Fri Nov 18, 2005 12:18 pm Post subject: download a html file |
|
|
| 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 |
|
 |
]Kami[ Owner

Joined: 24 Jul 2003 Posts: 590 Location: Slovenia
|
Posted: Fri Nov 18, 2005 12:41 pm Post subject: |
|
|
Well, you could do it with shell command, but u need to have wget installed
| 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 |
|
 |
rayman Voice
Joined: 18 Nov 2005 Posts: 4 Location: Germany
|
Posted: Fri Nov 18, 2005 12:45 pm Post subject: |
|
|
Or you can use lynx (if installed)
| Code: | exec lynx -dump http://www.somesite.com/somepage.html >somefile.tmp
|
Greetz
rayman |
|
| Back to top |
|
 |
demond Revered One

Joined: 12 Jun 2004 Posts: 3073 Location: San Francisco, CA
|
Posted: Sat Nov 19, 2005 12:05 am Post subject: |
|
|
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 |
|
 |
BlinK_ Voice
Joined: 18 Nov 2005 Posts: 4
|
Posted: Sat Nov 19, 2005 4:47 am Post subject: |
|
|
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 |
|
 |
demond Revered One

Joined: 12 Jun 2004 Posts: 3073 Location: San Francisco, CA
|
Posted: Sat Nov 19, 2005 6:28 am Post subject: |
|
|
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 |
|
 |
BlinK_ Voice
Joined: 18 Nov 2005 Posts: 4
|
Posted: Sat Nov 19, 2005 7:29 am Post subject: |
|
|
| of course i have no exp in tcl scripting. that is why i'm asking help. |
|
| Back to top |
|
 |
|