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

  1. proc geturl {url} {
  2. if {[catch {http::geturl $url -timeout 30000} tok]} {
  3. puts stderr "Couldn't fetch $url"
  4. } else {
  5. if {[http::status $tok] == "ok"} {
  6. return [http::data $tok]
  7. }
  8. }
  9. http::cleanup $tok
  10. }
  11.  
  12. package require http
  13. package require md5
  14. package require struct
  15. package require htmlparse
  16.  
  17. set url http://mises.org/
  18.  
  19. set data [geturl $url]
  20.  
  21. ::struct::tree t
  22. ::htmlparse::2tree $data t
  23.  
  24.  
  25.