Skip to content

Instantly share code, notes, and snippets.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@kjam
kjam / geturl.tcl
Created January 20, 2017 17:25
TCL & Perl Web scraper from The Practice of Programming by Brian W. Kernighan and Rob Pike
# geturl.tcl: retrieve document from URL
# input has form [http://]abc.def.com[/whatever...]
regsub "http://" $argv "" argv ;# remove http:// if present
regsub "/" $argv " " argv ;# replace leading / with blank
set so [socket [lindex $argv 0] 80] ;# make network connection
set q "/[lindex $argv 1]"
puts $so "GET $q HTTP/1.0\n\n" ;# send request