j46t-q
Last Updated: February 25, 2016
·
1.003K
· sheerun
Photo on 08.01.2013 at 04.15

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
Say Thanks
Respond
Filed Under