In Linux, how does one simulate Http get or post requests?

Source: Internet
Author: User
Http requests refer to the request messages sent from the client to the server. Http requests are mainly divided into get or post. In Linux, curl and wget commands can be used to simulate Http requests. The following describes how to simulate Http get or post requests in Linux.

Http requests refer to the request messages sent from the client to the server. Http requests can be divided into get or post requests. In Linux, curl and wget can be used.CommandTo simulate Http requests. The following describes how to simulate Http get or post requests in Linux.

1. get request:

1. Use the curl command:

Curl "http://www.baidu.com" if the URL here points to a file or a picture, you can download it directly to your local

Curl-I http://www.baidu.com displays all information

Curl-l http://www.baidu.com displays only header information

Curl-v "http://www.baidu.com" displays get request full process resolution

2. Run the wget command:

Wget "http://www.baidu.com" can also

Ii. post requests

1. Use the curl command (use the-d parameter to put the access parameter in it ):

Curl-d "param1 = value1 1_m2 = value2" "http://www.baidu.com"

2. Run the wget command: (-- post-data parameter)

Wget -- post-data 'user = foo & password = bar' http://www.baidu.com

The preceding method simulates Http get or post requests in Linux, so that the Linux system can send messages to remote servers.

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.