Posted to tcl by Bradipo at Tue Jun 30 16:03:43 GMT 2009view pretty

proc geturl {url} {
  if {[catch {http::geturl $url -timeout 30000} tok]} {
    puts stderr "Couldn't fetch $url"
  } else {
    if {[http::status $tok] == "ok"} {
      return [http::data $tok]
    } 
  }
  http::cleanup $tok
}

package require http
package require md5
package require struct
package require htmlparse

set url http://mises.org/

set data [geturl $url]

::struct::tree t
::htmlparse::2tree $data t