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.