# getFromWeb # This Tcl&Tk procedure performs a HTTP # GET from the indicated web server and # stores the file in the specified file. proc getFromWeb { url file } { # LOAD HTTP PACKAGE package require http # IDENTIFY OUR WEB CLIENT ::http::config -useragent "ultra thin Tcl&Tk web agent" # OPEN OUTPUT FILE set outFile [open $file w] # CREATE CONNECTION TO URL, DOWNLOAD, # AND STORE TO FILE CHANNEL set token [::http::geturl $url -channel $outFile] close $outFile # RETURN TOKEN return $token }