1 overview
Curl is a file transfer tool that works in command-line mode based on URL syntax, a character command that can be used for scripting, which supports protocols such as FTP,FTPS, HTTP, HTTPS, GOPHER, TELNET, DICT, file, and LDAP. Curl supports HTTPS authentication, and supports HTTP post, put and other methods, FTP upload, Kerberos authentication, HTTP upload, proxy server, cookies, username/password Authentication, download file breakpoint continuation, upload file breakpoint continuation, HTTP proxy Server pipeline (proxy tunneling), also support IPV6,SOCKS5 proxy server, upload files via HTTP proxy server to FTP server, etc., the function is very powerful
ELinks information for obtaining a page
This article will describe the use of two tools
2 Curl Tool
Install the Service Pack yum-y install Curl
Curl format
curl [Options] [URL ...]
The common options for the Curl tool are described below:
-a/--user-agent set up user agent to send to server
-A can specify which user to initiate the request with, example curl-a "IE11" www.baidu.com, which is a request initiated by IE11 this browser
-e/--referer Source URL,-e can be used to forge source address, example CURL-E www.ghbsunny.comhttp:// 172.18.50.75, www.ghbsunny.com is not present at this time, but the server-side log can see the source of the access is www.ghbsunny.com
--cacert CA Certificate (SSL)
-k/--insecure allow certificates to be ignored for SSL connections
--compressed required to return is a compressed format, with this command, need to support the Web site compression, in order to compress
-h/--header Custom header information to the server, example: Curl
-H "host:www.sunny.com" http://172.18.50.75, construct a header is www.sunny.com sent to the server
-I display page content, including message header information
-i/--head only the response message header information is displayed
-d/--dump-header the header information of the URL in the specified file, which is equivalent to redirection, and the result header information is stored in the specified file. Example: The result of curl-d headfilehttp://172.18.50.75 is that the screen shows the information of the http://172.18.50.75 Web page, while the contents of the header are stored in the Headfile file in the current directory.
--limit-rate set the transfer speed in bytes, 1024 bytes
Generally used to get large files, access to a large amount of time to appropriate speed limit, the default unit is Bytes/second, you can add units, example Curl--limit-rate 1khttp://172.18.50.75, expressed at 1k per second download/HTTP/ 172.18.50.75 information on Web pages
--basic using HTTP Basic authentication
-u/--user set the user and password of the server, combined with the--basic option, example: Curl--basic-uhttp:pass123456http://172.18.50.63/basic/indicates that you want to get http:// 172.18.50.63/basic/this resource, need to pass Basic authentication, username: password is http:pass123456
-L for forced redirection, if there is a 3xx response code, re-send the request to a new location, the page after the jump to download, example: Curl-l--basic-u http:pass1234http://172.18.50.63/ Basic when basic does not have a crossbar, there is no-l option is to return 301 code, when the-l option, will automatically jump to get the correct resources
-O Save the network file as the specified file, example, curl--limit-rate 20-o fs3.loghttp://172.18.50.75/fs Download the http://172.18.50.75 file fs locally, Save to current directory The file is F3.log, and the throttle limit speed is 20byte/s
-O Use the default filename in the URL to save the file to local, do not need to rename the downloaded file name, default to the source file name, here is the capital letter O
-0/--http1.0 using HTTP 1.0 here is the number 0
-C-Option to use the file with a breakpoint to resume the function, download large files when used
-c/--cookie-jar Store the cookie in the URL in the specified file, example: Curl-c Baiducookiewww.baidu.com, which means to get the www.baidu.com cookie and save it to a local directory, named Baiducookie
-x/--proxy specifying a proxy server address
-x/--request sending a specified request method to the server
-u/--proxy-user Proxy Server user and password
The-t option uploads the specified local file to the FTP server
--data/-d mode specifies that data is passed using post
3 ELinks Tools
Install the Service Pack yum-y install ELinks
Format Elinks[option] ... [URL] ...
Common Options Introduction
ELinks If no option is added, the Interactive browser's page will be entered
-dump: Non-interactive mode, outputs the contents of the URL to standard output
Dump only look at text, if it is HTML page, font, color These effects will not be displayed, only the text appears
Example: ELinks--dumphttp://172.18.50.63/Direct access to http://172.18.50.63/page information
-source: Print source code, example: elinks--sourcewww.baidu.com Direct printing www.baidu.com source information
This article is from the "Sunshine Ops" blog, please be sure to keep this source http://ghbsunny.blog.51cto.com/7759574/1970452
Introduction to the HTTP curl and elinks tools