I need a command which will just send http request to required web directory? Does something like this exist?

  • 5
    curl and wget, for example.
    – meuh
    Sep 9 '15 at 14:37
  • What is a “web directory”? Give an example, please. Sep 9 '15 at 16:23

There are lots of ways:

nc www.example.com 80: upside is you have full controll over what you send, downside is you are on your own. Restrict to HTTP 1.0 to minimize the things you need to type GET / HTTP/1.0 followed by an empty line is all you need.

curl http://www.example.com/: good for normal use and debugging. Has lots of options. Especially usefull: --verbose to see the HTTP request/response and --head to send a HEAD request (no body).

openssl s_client -connect www.example.com:443: Useful for debugging HTTPS servers.

wget: good for download and maybe more.

w3m, lynx, links: text-only browser.

  • Downvote because of Telnet. Telnet has numerous shortcomings as a TCP client. Sep 9 '15 at 16:22
  • @IncnisMrsi: fixed. Sep 9 '15 at 16:26
  • Also consider GET, POST and HEAD (symlinks to lwp-request). Sep 10 '15 at 6:55

You can use wget to send an http request. For example:

wget http://unix.stackexchange.com

I like to use curl

curl http://www.example.com/

with a variable:

page_content=`curl http://www.example.com`
echo $page_content

(posting this separately to make SO voting possible).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.