Linux Curl Command Parameters

Source: Internet
Author: User
Tags send cookies

Linux Curl is a tool for uploading or downloading files under the command line via URL syntax, which supports a variety of protocols such as Http,https,ftp,ftps,telnet, which are often used to crawl Web pages and monitor the status of Web servers. One, example of Linux curl usage:1. Linux Curl Crawl Web page: Crawl Baidu: Curl http://www.baidu.comIf found garbled, you can use Iconv transcoding curl http://iframe.ip138.com/ic.asp|iconv-fgb2312use of Iconv see: In Linux/unix system using ICONV command to process text files Chinese garbled problem 2. Linux Curl uses proxy: Linux Curl uses HTTP proxy crawl page: Curl-X 111.95.243.36:80 http://iframe.ip138.com/ic.asp|iconv-fgb2312Curl-x 111.95.243.36:80-u Aiezu:password http://www.baidu.comcrawling pages with socks agent: Curl--SOCKS4 202.113.65.229:443 http://iframe.ip138.com/ic.asp|iconv-fgb2312Curl--SOCKS5 202.113.65.229:443 http://iframe.ip138.com/ic.asp|iconv-fgb2312The proxy server address can be obtained from the crawler agent. 3. Linux Curl Processing cookies receive Cookies:curl-c/tmp/cookies http://www.baidu.com #cookies保存到/tmp/cookies fileSend Cookies:curl-B "KEY1=VAL1;KEY2=VAL2;" http://www.baidu.com #发送cookies文本Curl-b/tmp/cookies http://www.baidu.com #从文件中读取cookies4. Linux Curl Send data: Linux curl Get way submit data: Curl-g-d "Name=value&name2=value2" http://www.baidu.comLinux Curl Post way to submit data: Curl-d "Name=value&name2=value2" http://www.baidu.com #post数据curl-d a=b&c=d&[email protected]/tmp/txt http://www.baidu.com #post文件upload a file as a form: Curl-F [email protected]/tmp/me.txt http://www.aiezu.comcorresponds to the method that sets form form= "POST" and enctype= ' Multipart/form-data 'two properties. 5. Linux Curl HTTP Header processing: Setting HTTP request header information: Curl-a "mozilla/5.0 firefox/21.0" http://www.baidu.com #设置http请求头User-agentCurl-e "http://pachong.org/" http://www.baidu.com #设置http请求头RefererCurl-h "connection:keep-alive \ user-agent:mozilla/5.0" http://www.aiezu.comSet HTTP response header processing: Curl-I. http://www.aiezu.com #仅仅返回headercurl-d/tmp/header http://www.aiezu.com #将http Header saved to/tmp/header file6. Linux Curl Certification: Curl-U aiezu:password http://www.aiezu.com #用户名密码认证CURL-E Mycert.pem https://www.baidu.com #采用证书认证6. Other: Curl-# http://www.baidu.com #以 "#" Output progress barCurl-o/tmp/aiezu http://www.baidu.com #保存http响应到/tmp/aiezuLinux uses Curl Little lessons: HTTP request address URLs to use"" is enclosed. Errors may occur when there are multiple parameters used & connected.

Linux Curl Command Parameters

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.