| View previous topic :: View next topic |
| Author |
Message |
oO3ddYOo Voice
Joined: 09 Feb 2008 Posts: 2
|
Posted: Sat Feb 09, 2008 3:37 pm Post subject: Download and save a txt File |
|
|
Hi @ll
I search this Request in all forums but i didnt find anything.
What i will:
I want a Tcl Script to download a txt file from a homepage and save a specified path.
Example:
!download
He download or open the txt file: http://www.mywebspace.de/maps.txt
and save this file to eggdrop/scripts
If the txt file already exists he have to overwrite/delete the old one.
I hope someone can help.
Sorry for my bad english, i come from Germany *g*
Thanks for all help  |
|
| Back to top |
|
 |
Maiki Voice
Joined: 20 May 2007 Posts: 28
|
Posted: Sat Feb 09, 2008 4:03 pm Post subject: |
|
|
| Code: | ## Set url
set url "http://www.mywebspace.de/maps.txt"
##################### No edit ######################
if {[catch {package require http} error]} { putlog "Error=$error" }
bind pub - !download download
proc download {nick uhost hand chan arg} {
set tok [http::geturl $::url]
set data [http::data $tok]
http::cleanup $tok
set fs [open scripts/download.txt w]; puts $fs $data; close $fs
} |
|
|
| Back to top |
|
 |
oO3ddYOo Voice
Joined: 09 Feb 2008 Posts: 2
|
Posted: Sat Feb 09, 2008 4:20 pm Post subject: |
|
|
What the [censored]
I search many hours and u make it in few minutes
BIG THANX  |
|
| Back to top |
|
 |
|