GET webpage using only bash (no CURL involved)
get() {
local address=${1##*//}
local host=${address%%/*}
local path="${address#$host}"
exec 3<> "/dev/tcp/$host/80"
echo -e "GET $path HTTP/1.1\nHost: $host\nConnection: close\n\n" >&3
cat <&3 | sed "1,/^.$/d"
}
get http://www.google.com/foobar
Written by Adam Stankiewicz
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Shell
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#