Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Read an HTML URL 1

Status
Not open for further replies.

xavier64

Technical User
Nov 18, 2002
12
FR
I make a script, and i want to read the result (or download the file) of an url (
I don't want to display it, only get the result on a variable or on a downloaded file.

Is someone have an idea....

Thanks,

Xav
 
Have you looked at the man pages or the docs that came
with your tcl?
The package you want is http.

Here is a quick sample of how to download
a binary file using an url given as argument one
to the script

Code:
#!/usr/bin/tclsh
package require http 1.0

proc mproggy {token tot cur} {
puts -nonewline stdout "."
flush stdout
}

proc rseed {} {
 return [expr int(1 + rand() * 12322)]
}

 set url [lindex $argv 0]
 set chan [open "/directoryname/d[rseed].mpg" w]
 fconfigure $chan -translation binary
 set mhandle [http_get $url -channel $chan -progress mproggy]
 
Thanks,

i gonna buy eyes (for the doc).

Xav
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top