Telnet – Send GET/HEAD HTTP Request

Telnet is a tool for connecting to servers on a given port for troubleshooting connection issues.

One of the most common tasks that you can do via telnet – is connect to some web server and verify its health by checking the response code in HTTP header.

Or you can get the content of a whole web page via telnet if you need to analyze it deeper.

Cool Tip: Familiar with `telnet` or `curl`? Check a website availability from the Linux command line, like a PRO! Read more →

Below you will find the examples of sending GET and HEAD request to a web server from the command line using telnet.

Telnet – Check HTTP Response

Use the following syntax to connect to a [SERVER] on some [PORT] via telnet and request it for HTTP header of some [WEB PAGE]:

$ telnet [SERVER] [PORT]
Trying xxx.xxx.xxx.xxx...
Connected to [SERVER].
Escape character is '^]'.
HEAD [WEB PAGE] HTTP/1.1
HOST: [SERVER]
<Press ENTER>

Check the HTTP header of this website’s main page using telnet:

$ telnet www.shellhacks.com 80
Trying xxx.xxx.xxx.xxx...
Connected to www.shellhacks.com.
Escape character is '^]'.
HEAD / HTTP/1.1       
HOST: www.shellhacks.com
<Press ENTER>

Check the HTTP header of the current web page using telnet:

$ telnet www.shellhacks.com 80
Trying xxx.xxx.xxx.xxx...
Connected to www.shellhacks.com.
Escape character is '^]'.
HEAD /telnet-send-get-head-http-request HTTP/1.1
HOST: www.shellhacks.com
<Press ENTER>

Telnet – Get Web Page’s Content

 

Probably it is not enough just to receive an HTTP response code from the web server.

 

For example you may need to ensure that some particular text exists on a web page.

For this you can download the entire web page using telnet and then perform more deeper analyze of its content.

Cool Tip: Slow website performance? Check response time from the Linux command line! Read more →

Use the following syntax to connect to some [SERVER] on some [PORT] via telnet and request the content of a [WEB PAGE]:

$ telnet [SERVER] [PORT]
Trying xxx.xxx.xxx.xxx...
Connected to [SERVER].
Escape character is '^]'.
GET [WEB PAGE] HTTP/1.1
HOST: [SERVER]
<Press ENTER>

Get the content of this website’s main page using telnet:

$ telnet www.shellhacks.com 80
Trying xxx.xxx.xxx.xxx...
Connected to www.shellhacks.com.
Escape character is '^]'.
GET / HTTP/1.1       
HOST: www.shellhacks.com
<Press ENTER>

Request the server for the content of the current web page using telnet:

$ telnet www.shellhacks.com 80
Trying xxx.xxx.xxx.xxx...
Connected to www.shellhacks.com.
Escape character is '^]'.
GET /telnet-send-get-head-http-request HTTP/1.1
HOST: www.shellhacks.com
<Press ENTER>
0 (0)
Article Rating (No Votes)
Rate this article
Attachments
There are no attachments for this article.
Comments
There are no comments for this article. Be the first to post a comment.
Full Name
Email Address
Security Code Security Code
Related Articles RSS Feed
Set Up SSH Tunneling on a Linux / Unix / BSD Server To Bypass NAT
Viewed 11386 times since Fri, May 15, 2020
debian Debian/Ubuntu Linux: Find If Installed APT Package Includes a Fix/Patch Via CVE Number
Viewed 9544 times since Sun, Sep 23, 2018
RHEL : How to deal with “CLOSE_WAIT” and “TIME_WAIT” connection
Viewed 26354 times since Thu, Feb 14, 2019
How log rotation works with logrotate
Viewed 4971 times since Fri, Nov 30, 2018
How to mount software RAID1 member using mdadm
Viewed 3111 times since Wed, Oct 3, 2018
RHEL: Retrieve and generate a unique SCSI identifier
Viewed 3203 times since Sat, Jun 2, 2018
Split and Reassemble files
Viewed 3565 times since Mon, May 28, 2018
INSTALACJA MIB SNMP W SYSTEMIE CENTOS/RHEL 6
Viewed 13072 times since Fri, Nov 30, 2018
A tcpdump Tutorial and Primer with Examples
Viewed 5346 times since Sun, Jun 17, 2018
Logowanie za pomocą kluczy Secure Shell
Viewed 3040 times since Thu, May 24, 2018