Telnet Implementation HTTP protocol

Source: Internet
Author: User

Environment: Widows and Linux are all OK, but Windows does not work well. This article is based on Linux

Purpose: To understand the Application Layer protocol HTTP, manual method knocking protocol.


Once you have established a connection with Telnet, you can implement the protocol manually. Telnet can connect not only 23 ports on the server, but also other ports, such as 21,25,80.


Get page

1, with Baidu to establish HTTP connection Telnet www.baidu.com 80

Output

fym@g470:~/www/public_html/test$ telnet www.baidu.com trying 61.135.169.125 ...   Connected to www.a.shifen.com. Escape character is ' ^] '.
2. Send GET request Home content

get/http/1.1
When you enter the above line, hit the ENTER key two times. Then you can see Baidu returned to you the content of the home page.


POST Send on data

Server-side PHP code, formaction.php

<?php Import_request_variables (GP, "Formval_");   echo "name =". $formval _name;   echo "<br/>";   echo "age =" $formval _age; ?>
after the Telnet host, post data

fym@g470:~/www/public_html/test$ telnet fym.vacau.com trying 31.170.161.196 ...   Connected to fym.vacau.com.   Escape character is ' ^] '. post/test/formaction.php http/1.1 HOST:fym.vacau.com content-type:application/x-www-form-urlencoded Content-Lengt H:15 name=fym&age=26

Service-side loopback data

http/1.1 OK Date:sat, June 04:15:38 GMT Server:apache x-powered-by:php/5.2.17 content-length:178 Connection:close content-type:text/html name = fym<br/>age = 26
Get

fym@g470:~/www/public_html/test$ telnet fym.vacau.com trying 31.170.161.196 ...   Connected to fym.vacau.com.   Escape character is ' ^] '. Get/test/formaction.php?name=fym&age=26 http/1.1 HOST:fym.vacau.com

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.