In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
What the commonly used curl command scenarios are, many novices are not very clear about this. In order to help you solve this problem, the following editor will explain it in detail. People with this need can come and learn. I hope you can get something.
Curl is a command on linux that can send http requests. Of course, Postman is a good interface call management tool, but in the case of verifying the availability of one linux server calling another linux server API, it is the curl command.
The following is mainly to introduce the commonly used curl command scenarios, you can accumulate some operation and maintenance knowledge and apply it in daily development work.
Open a website curl www.mynamecoder.com to send a POST request curl-d "userName=xiaoming&password=coder1024" http://www.mynamecoder.com/login parameter description-d: specify the passed parameter
After using the-d parameter, the HTTP request automatically adds the request header Content-Type: application/x-www-form-urlencoded. And the request is automatically converted to the POST method.
Send GET request curl-G "title=curl" http://www.mynamecoder.com/search parameter description-G: indicates get request Default is post request to send POST request in JSON format $curl-d'{"userName": "xiaoming", "password": "123456"}'- H 'Content-Type: application/json' https://www.mynamecoder.com/login parameter description-H: indicates that the HTTP request header upload file curl-F' file=@head.png' https://mynamecoder.com/upload parameter description
The above command adds the header Content-Type: multipart/form-data to the HTTP request and then uploads the file photo.png as a file field.
The-F parameter can specify the MIME type.
Curl-F 'file=@photo.png;type=image/png' https://mynamecoder.com/upload
The above command specifies that the MIME type is image/png, otherwise curl will set the MIME type to application/octet-stream by default.
The-F parameter can also specify a file name.
$curl-F 'file=@photo.png;filename=me.png' https://mynamecoder.com/upload
In the above command, the original file name is photo.png, but the file received by the server is called me.png.
Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.