command to hit url in linux 1

command to hit url in linux

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.

Here is what the above code is Doing:
1. We’re importing the socket module, which provides us with all the functions we need to create a socket.
2. We’re creating a socket object.
3. We’re connecting to the server.
4. We’re sending a GET request to the server.
5. We’re receiving the response from the server.
6. We’re printing the response.
7. We’re closing the connection.

Similar Posts