ElasticSearch快速入门三(curl命令讲解)

API测试工具_微博开放平台:https://open.weibo.com/tools/console#  

感兴趣是可以使用这个工具玩一下restful接口调用,可以更形象的了解restful

下面我们就继续下面的内内容讲解curl命令

什么是CURL?
就是以命令的方式来执行HTTP协议的请求的工具
可以通过CURL操作HTTP的GET/POST/PUT/DELETE方法

 下面我们就详细说下CURL这个命令的使用,这个curl命令在linux下是自带的,登陆一个linux的操作系统

我们看一下curl  --help查看帮助这个curl命令有那些参数,看到有很多

[root@backup01 java]# curl --help
Usage: curl [options...] <url>
Options: (H) means HTTP/HTTPS only, (F) means FTP only--anyauth       Pick "any" authentication method (H)-a, --append        Append to target file when uploading (F/SFTP)--basic         Use HTTP Basic Authentication (H)--cacert FILE   CA certificate to verify peer against (SSL)--capath DIR    CA directory to verify peer against (SSL)-E, --cert CERT[:PASSWD] Client certificate file and password (SSL)--cert-type TYPE Certificate file type (DER/PEM/ENG) (SSL)--ciphers LIST  SSL ciphers to use (SSL)--compressed    Request compressed response (using deflate or gzip)-K, --config FILE   Specify which config file to read--connect-timeout SECONDS  Maximum time allowed for connection-C, --continue-at OFFSET  Resumed transfer offset-b, --cookie STRING/FILE  String or file to read cookies from (H)-c, --cookie-jar FILE  Write cookies to this file after operation (H)--create-dirs   Create necessary local directory hierarchy--crlf          Convert LF to CRLF in upload--crlfile FILE  Get a CRL list in PEM format from the given file-d, --data DATA     HTTP POST data (H)--data-ascii DATA  HTTP POST ASCII data (H)--data-binary DATA  HTTP POST binary data (H)--data-urlencode DATA  HTTP POST data url encoded (H)--delegation STRING GSS-API delegation permission--digest        Use HTTP Digest Authentication (H)--disable-eprt  Inhibit using EPRT or LPRT (F)--disable-epsv  Inhibit using EPSV (F)-D, --dump-header FILE  Write the headers to this file--egd-file FILE  EGD socket path for random data (SSL)--engine ENGINGE  Crypto engine (SSL). "--engine list" for list-f, --fail          Fail silently (no output at all) on HTTP errors (H)-F, --form CONTENT  Specify HTTP multipart POST data (H)--form-string STRING  Specify HTTP multipart POST data (H)--ftp-account DATA  Account data string (F)--ftp-alternative-to-user COMMAND  String to replace "USER [name]" (F)--ftp-create-dirs  Create the remote dirs if not present (F)--ftp-method [MULTICWD/NOCWD/SINGLECWD] Control CWD usage (F)--ftp-pasv      Use PASV/EPSV instead of PORT (F)-P, --ftp-port ADR  Use PORT with given address instead of PASV (F)--ftp-skip-pasv-ip Skip the IP address for PASV (F)--ftp-pret      Send PRET before PASV (for drftpd) (F)--ftp-ssl-ccc   Send CCC after authenticating (F)--ftp-ssl-ccc-mode ACTIVE/PASSIVE  Set CCC mode (F)--ftp-ssl-control Require SSL/TLS for ftp login, clear for transfer (F)-G, --get           Send the -d data with a HTTP GET (H)-g, --globoff       Disable URL sequences and ranges using {} and []-H, --header LINE   Custom header to pass to server (H)-I, --head          Show document info only-h, --help          This help text--hostpubmd5 MD5  Hex encoded MD5 string of the host public key. (SSH)-0, --http1.0       Use HTTP 1.0 (H)--ignore-content-length  Ignore the HTTP Content-Length header-i, --include       Include protocol headers in the output (H/F)-k, --insecure      Allow connections to SSL sites without certs (H)--interface INTERFACE  Specify network interface/address to use-4, --ipv4          Resolve name to IPv4 address-6, --ipv6          Resolve name to IPv6 address-j, --junk-session-cookies Ignore session cookies read from file (H)--keepalive-time SECONDS  Interval between keepalive probes--key KEY       Private key file name (SSL/SSH)--key-type TYPE Private key file type (DER/PEM/ENG) (SSL)--krb LEVEL     Enable Kerberos with specified security level (F)--libcurl FILE  Dump libcurl equivalent code of this command line--limit-rate RATE  Limit transfer speed to this rate-l, --list-only     List only names of an FTP directory (F)--local-port RANGE  Force use of these local port numbers-L, --location      Follow redirects (H)--location-trusted like --location and send auth to other hosts (H)-M, --manual        Display the full manual--mail-from FROM  Mail from this address--mail-rcpt TO  Mail to this receiver(s)--mail-auth AUTH  Originator address of the original email--max-filesize BYTES  Maximum file size to download (H/F)--max-redirs NUM  Maximum number of redirects allowed (H)-m, --max-time SECONDS  Maximum time allowed for the transfer--metalink      Process given URLs as metalink XML file--negotiate     Use HTTP Negotiate Authentication (H)-n, --netrc         Must read .netrc for user name and password--netrc-optional Use either .netrc or URL; overrides -n--netrc-file FILE  Set up the netrc filename to use-N, --no-buffer     Disable buffering of the output stream--no-keepalive  Disable keepalive use on the connection--no-sessionid  Disable SSL session-ID reusing (SSL)--noproxy       List of hosts which do not use proxy--ntlm          Use HTTP NTLM authentication (H)-o, --output FILE   Write output to <file> instead of stdout--pass PASS     Pass phrase for the private key (SSL/SSH)--post301       Do not switch to GET after following a 301 redirect (H)--post302       Do not switch to GET after following a 302 redirect (H)--post303       Do not switch to GET after following a 303 redirect (H)-#, --progress-bar  Display transfer progress as a progress bar--proto PROTOCOLS  Enable/disable specified protocols--proto-redir PROTOCOLS  Enable/disable specified protocols on redirect-x, --proxy [PROTOCOL://]HOST[:PORT] Use proxy on given port--proxy-anyauth Pick "any" proxy authentication method (H)--proxy-basic   Use Basic authentication on the proxy (H)--proxy-digest  Use Digest authentication on the proxy (H)--proxy-negotiate Use Negotiate authentication on the proxy (H)--proxy-ntlm    Use NTLM authentication on the proxy (H)-U, --proxy-user USER[:PASSWORD]  Proxy user and password--proxy1.0 HOST[:PORT]  Use HTTP/1.0 proxy on given port-p, --proxytunnel   Operate through a HTTP proxy tunnel (using CONNECT)--pubkey KEY    Public key file name (SSH)-Q, --quote CMD     Send command(s) to server before transfer (F/SFTP)--random-file FILE  File for reading random data from (SSL)-r, --range RANGE   Retrieve only the bytes within a range--raw           Do HTTP "raw", without any transfer decoding (H)-e, --referer       Referer URL (H)-J, --remote-header-name Use the header-provided filename (H)-O, --remote-name   Write output to a file named as the remote file--remote-name-all Use the remote file name for all URLs-R, --remote-time   Set the remote file's time on the local output-X, --request COMMAND  Specify request command to use--resolve HOST:PORT:ADDRESS  Force resolve of HOST:PORT to ADDRESS--retry NUM   Retry request NUM times if transient problems occur--retry-delay SECONDS When retrying, wait this many seconds between each--retry-max-time SECONDS  Retry only within this period-S, --show-error    Show error. With -s, make curl show errors when they occur-s, --silent        Silent mode. Don't output anything--socks4 HOST[:PORT]  SOCKS4 proxy on given host + port--socks4a HOST[:PORT]  SOCKS4a proxy on given host + port--socks5 HOST[:PORT]  SOCKS5 proxy on given host + port--socks5-basic  Enable username/password auth for SOCKS5 proxies--socks5-gssapi Enable GSS-API auth for SOCKS5 proxies--socks5-hostname HOST[:PORT] SOCKS5 proxy, pass host name to proxy--socks5-gssapi-service NAME  SOCKS5 proxy service name for gssapi--socks5-gssapi-nec  Compatibility with NEC SOCKS5 server-Y, --speed-limit RATE  Stop transfers below speed-limit for 'speed-time' secs-y, --speed-time SECONDS  Time for trig speed-limit abort. Defaults to 30--ssl           Try SSL/TLS (FTP, IMAP, POP3, SMTP)--ssl-reqd      Require SSL/TLS (FTP, IMAP, POP3, SMTP)-2, --sslv2         Use SSLv2 (SSL)-3, --sslv3         Use SSLv3 (SSL)--ssl-allow-beast Allow security flaw to improve interop (SSL)--stderr FILE   Where to redirect stderr. - means stdout--tcp-nodelay   Use the TCP_NODELAY option-t, --telnet-option OPT=VAL  Set telnet option--tftp-blksize VALUE  Set TFTP BLKSIZE option (must be >512)-z, --time-cond TIME  Transfer based on a time condition-1, --tlsv1         Use => TLSv1 (SSL)--tlsv1.0       Use TLSv1.0 (SSL)--tlsv1.1       Use TLSv1.1 (SSL)--tlsv1.2       Use TLSv1.2 (SSL)--trace FILE    Write a debug trace to the given file--trace-ascii FILE  Like --trace but without the hex output--trace-time    Add time stamps to trace/verbose output--tr-encoding   Request compressed transfer encoding (H)-T, --upload-file FILE  Transfer FILE to destination--url URL       URL to work with-B, --use-ascii     Use ASCII/text transfer-u, --user USER[:PASSWORD]  Server user and password--tlsuser USER  TLS username--tlspassword STRING TLS password--tlsauthtype STRING  TLS authentication type (default SRP)--unix-socket FILE    Connect through this UNIX domain socket-A, --user-agent STRING  User-Agent to send to server (H)-v, --verbose       Make the operation more talkative-V, --version       Show version number and quit-w, --write-out FORMAT  What to output after completion--xattr        Store metadata in extended file attributes-q                 If used as the first parameter disables .curlrc
[root@backup01 java]# 

看到这么多参数,有点晕乎,其实不用背,当你用到的时候去查一下

下面我们使用这个curl名师实际操作一下,比如我能直接访问百度

报了一个未知错误百度了一下这个问题,都说是DNS的问题,因此修改一下DNS配置,

vim /etc/resolv.conf

修改之后的

然后重新     curl www.baidu.com

html的页面已经成功返回

结果只是加上了nameserver 114.114.114.114就可以了,网上了解到的可能是电信DNS有调整的缘故,但是具体的原因还是不得而知。

 

 

如果我们要保存这个网页我们只需要命令加一个  -o   就可以了

curl -o baidu.html www.baidu.com

我们打开这个baidu.html看下

curl -i www.baidu.com  显示http response请求头信息

 

curl -v www.baidu.com

 

curl --trace output.txt www.baidu.com  (把信息输入到文本中)

cat output.txt   (查看txt文件)

[root@backup01 local]# cat output.txt 
== Info: About to connect() to www.baidu.com port 80 (#0)
== Info:   Trying 14.215.177.39...
== Info: Connected to www.baidu.com (14.215.177.39) port 80 (#0)
=> Send header, 77 bytes (0x4d)
0000: 47 45 54 20 2f 20 48 54 54 50 2f 31 2e 31 0d 0a GET / HTTP/1.1..
0010: 55 73 65 72 2d 41 67 65 6e 74 3a 20 63 75 72 6c User-Agent: curl
0020: 2f 37 2e 32 39 2e 30 0d 0a 48 6f 73 74 3a 20 77 /7.29.0..Host: w
0030: 77 77 2e 62 61 69 64 75 2e 63 6f 6d 0d 0a 41 63 ww.baidu.com..Ac
0040: 63 65 70 74 3a 20 2a 2f 2a 0d 0a 0d 0a          cept: */*....
<= Recv header, 17 bytes (0x11)
0000: 48 54 54 50 2f 31 2e 31 20 32 30 30 20 4f 4b 0d HTTP/1.1 200 OK.
0010: 0a                                              .
<= Recv header, 22 bytes (0x16)
0000: 41 63 63 65 70 74 2d 52 61 6e 67 65 73 3a 20 62 Accept-Ranges: b
0010: 79 74 65 73 0d 0a                               ytes..
<= Recv header, 76 bytes (0x4c)
0000: 43 61 63 68 65 2d 43 6f 6e 74 72 6f 6c 3a 20 70 Cache-Control: p
0010: 72 69 76 61 74 65 2c 20 6e 6f 2d 63 61 63 68 65 rivate, no-cache
0020: 2c 20 6e 6f 2d 73 74 6f 72 65 2c 20 70 72 6f 78 , no-store, prox
0030: 79 2d 72 65 76 61 6c 69 64 61 74 65 2c 20 6e 6f y-revalidate, no
0040: 2d 74 72 61 6e 73 66 6f 72 6d 0d 0a             -transform..
<= Recv header, 24 bytes (0x18)
0000: 43 6f 6e 6e 65 63 74 69 6f 6e 3a 20 6b 65 65 70 Connection: keep
0010: 2d 61 6c 69 76 65 0d 0a                         -alive..
<= Recv header, 22 bytes (0x16)
0000: 43 6f 6e 74 65 6e 74 2d 4c 65 6e 67 74 68 3a 20 Content-Length: 
0010: 32 33 38 31 0d 0a                               2381..
<= Recv header, 25 bytes (0x19)
0000: 43 6f 6e 74 65 6e 74 2d 54 79 70 65 3a 20 74 65 Content-Type: te
0010: 78 74 2f 68 74 6d 6c 0d 0a                      xt/html..
<= Recv header, 37 bytes (0x25)
0000: 44 61 74 65 3a 20 53 61 74 2c 20 30 37 20 4d 61 Date: Sat, 07 Ma
0010: 72 20 32 30 32 30 20 30 37 3a 31 31 3a 32 37 20 r 2020 07:11:27 
0020: 47 4d 54 0d 0a                                  GMT..
<= Recv header, 22 bytes (0x16)
0000: 45 74 61 67 3a 20 22 35 38 38 36 30 34 64 63 2d Etag: "588604dc-
0010: 39 34 64 22 0d 0a                               94d"..
<= Recv header, 46 bytes (0x2e)
0000: 4c 61 73 74 2d 4d 6f 64 69 66 69 65 64 3a 20 4d Last-Modified: M
0010: 6f 6e 2c 20 32 33 20 4a 61 6e 20 32 30 31 37 20 on, 23 Jan 2017 
0020: 31 33 3a 32 37 3a 35 36 20 47 4d 54 0d 0a       13:27:56 GMT..
<= Recv header, 18 bytes (0x12)
0000: 50 72 61 67 6d 61 3a 20 6e 6f 2d 63 61 63 68 65 Pragma: no-cache
0010: 0d 0a                                           ..
<= Recv header, 22 bytes (0x16)
0000: 53 65 72 76 65 72 3a 20 62 66 65 2f 31 2e 30 2e Server: bfe/1.0.
0010: 38 2e 31 38 0d 0a                               8.18..
<= Recv header, 67 bytes (0x43)
0000: 53 65 74 2d 43 6f 6f 6b 69 65 3a 20 42 44 4f 52 Set-Cookie: BDOR
0010: 5a 3d 32 37 33 31 35 3b 20 6d 61 78 2d 61 67 65 Z=27315; max-age
0020: 3d 38 36 34 30 30 3b 20 64 6f 6d 61 69 6e 3d 2e =86400; domain=.
0030: 62 61 69 64 75 2e 63 6f 6d 3b 20 70 61 74 68 3d baidu.com; path=
0040: 2f 0d 0a                                        /..
<= Recv header, 2 bytes (0x2)
0000: 0d 0a                                           ..
<= Recv data, 1040 bytes (0x410)
0000: 3c 21 44 4f 43 54 59 50 45 20 68 74 6d 6c 3e 0d <!DOCTYPE html>.
0010: 0a 3c 21 2d 2d 53 54 41 54 55 53 20 4f 4b 2d 2d .<!--STATUS OK--
0020: 3e 3c 68 74 6d 6c 3e 20 3c 68 65 61 64 3e 3c 6d ><html> <head><m
0030: 65 74 61 20 68 74 74 70 2d 65 71 75 69 76 3d 63 eta http-equiv=c
0040: 6f 6e 74 65 6e 74 2d 74 79 70 65 20 63 6f 6e 74 ontent-type cont
0050: 65 6e 74 3d 74 65 78 74 2f 68 74 6d 6c 3b 63 68 ent=text/html;ch
0060: 61 72 73 65 74 3d 75 74 66 2d 38 3e 3c 6d 65 74 arset=utf-8><met
0070: 61 20 68 74 74 70 2d 65 71 75 69 76 3d 58 2d 55 a http-equiv=X-U
0080: 41 2d 43 6f 6d 70 61 74 69 62 6c 65 20 63 6f 6e A-Compatible con
0090: 74 65 6e 74 3d 49 45 3d 45 64 67 65 3e 3c 6d 65 tent=IE=Edge><me
00a0: 74 61 20 63 6f 6e 74 65 6e 74 3d 61 6c 77 61 79 ta content=alway
00b0: 73 20 6e 61 6d 65 3d 72 65 66 65 72 72 65 72 3e s name=referrer>
00c0: 3c 6c 69 6e 6b 20 72 65 6c 3d 73 74 79 6c 65 73 <link rel=styles
00d0: 68 65 65 74 20 74 79 70 65 3d 74 65 78 74 2f 63 heet type=text/c
00e0: 73 73 20 68 72 65 66 3d 68 74 74 70 3a 2f 2f 73 ss href=http://s
00f0: 31 2e 62 64 73 74 61 74 69 63 2e 63 6f 6d 2f 72 1.bdstatic.com/r
0100: 2f 77 77 77 2f 63 61 63 68 65 2f 62 64 6f 72 7a /www/cache/bdorz
0110: 2f 62 61 69 64 75 2e 6d 69 6e 2e 63 73 73 3e 3c /baidu.min.css><
0120: 74 69 74 6c 65 3e e7 99 be e5 ba a6 e4 b8 80 e4 title>..........
0130: b8 8b ef bc 8c e4 bd a0 e5 b0 b1 e7 9f a5 e9 81 ................
0140: 93 3c 2f 74 69 74 6c 65 3e 3c 2f 68 65 61 64 3e .</title></head>
0150: 20 3c 62 6f 64 79 20 6c 69 6e 6b 3d 23 30 30 30  <body link=#000
0160: 30 63 63 3e 20 3c 64 69 76 20 69 64 3d 77 72 61 0cc> <div id=wra
0170: 70 70 65 72 3e 20 3c 64 69 76 20 69 64 3d 68 65 pper> <div id=he
0180: 61 64 3e 20 3c 64 69 76 20 63 6c 61 73 73 3d 68 ad> <div class=h
0190: 65 61 64 5f 77 72 61 70 70 65 72 3e 20 3c 64 69 ead_wrapper> <di
01a0: 76 20 63 6c 61 73 73 3d 73 5f 66 6f 72 6d 3e 20 v class=s_form> 
01b0: 3c 64 69 76 20 63 6c 61 73 73 3d 73 5f 66 6f 72 <div class=s_for
01c0: 6d 5f 77 72 61 70 70 65 72 3e 20 3c 64 69 76 20 m_wrapper> <div 
01d0: 69 64 3d 6c 67 3e 20 3c 69 6d 67 20 68 69 64 65 id=lg> <img hide
01e0: 66 6f 63 75 73 3d 74 72 75 65 20 73 72 63 3d 2f focus=true src=/
01f0: 2f 77 77 77 2e 62 61 69 64 75 2e 63 6f 6d 2f 69 /www.baidu.com/i
0200: 6d 67 2f 62 64 5f 6c 6f 67 6f 31 2e 70 6e 67 20 mg/bd_logo1.png 
0210: 77 69 64 74 68 3d 32 37 30 20 68 65 69 67 68 74 width=270 height
0220: 3d 31 32 39 3e 20 3c 2f 64 69 76 3e 20 3c 66 6f =129> </div> <fo
0230: 72 6d 20 69 64 3d 66 6f 72 6d 20 6e 61 6d 65 3d rm id=form name=
0240: 66 20 61 63 74 69 6f 6e 3d 2f 2f 77 77 77 2e 62 f action=//www.b
0250: 61 69 64 75 2e 63 6f 6d 2f 73 20 63 6c 61 73 73 aidu.com/s class
0260: 3d 66 6d 3e 20 3c 69 6e 70 75 74 20 74 79 70 65 =fm> <input type
0270: 3d 68 69 64 64 65 6e 20 6e 61 6d 65 3d 62 64 6f =hidden name=bdo
0280: 72 7a 5f 63 6f 6d 65 20 76 61 6c 75 65 3d 31 3e rz_come value=1>
0290: 20 3c 69 6e 70 75 74 20 74 79 70 65 3d 68 69 64  <input type=hid
02a0: 64 65 6e 20 6e 61 6d 65 3d 69 65 20 76 61 6c 75 den name=ie valu
02b0: 65 3d 75 74 66 2d 38 3e 20 3c 69 6e 70 75 74 20 e=utf-8> <input 
02c0: 74 79 70 65 3d 68 69 64 64 65 6e 20 6e 61 6d 65 type=hidden name
02d0: 3d 66 20 76 61 6c 75 65 3d 38 3e 20 3c 69 6e 70 =f value=8> <inp
02e0: 75 74 20 74 79 70 65 3d 68 69 64 64 65 6e 20 6e ut type=hidden n
02f0: 61 6d 65 3d 72 73 76 5f 62 70 20 76 61 6c 75 65 ame=rsv_bp value
0300: 3d 31 3e 20 3c 69 6e 70 75 74 20 74 79 70 65 3d =1> <input type=
0310: 68 69 64 64 65 6e 20 6e 61 6d 65 3d 72 73 76 5f hidden name=rsv_
0320: 69 64 78 20 76 61 6c 75 65 3d 31 3e 20 3c 69 6e idx value=1> <in
0330: 70 75 74 20 74 79 70 65 3d 68 69 64 64 65 6e 20 put type=hidden 
0340: 6e 61 6d 65 3d 74 6e 20 76 61 6c 75 65 3d 62 61 name=tn value=ba
0350: 69 64 75 3e 3c 73 70 61 6e 20 63 6c 61 73 73 3d idu><span class=
0360: 22 62 67 20 73 5f 69 70 74 5f 77 72 22 3e 3c 69 "bg s_ipt_wr"><i
0370: 6e 70 75 74 20 69 64 3d 6b 77 20 6e 61 6d 65 3d nput id=kw name=
0380: 77 64 20 63 6c 61 73 73 3d 73 5f 69 70 74 20 76 wd class=s_ipt v
0390: 61 6c 75 65 20 6d 61 78 6c 65 6e 67 74 68 3d 32 alue maxlength=2
03a0: 35 35 20 61 75 74 6f 63 6f 6d 70 6c 65 74 65 3d 55 autocomplete=
03b0: 6f 66 66 20 61 75 74 6f 66 6f 63 75 73 3e 3c 2f off autofocus></
03c0: 73 70 61 6e 3e 3c 73 70 61 6e 20 63 6c 61 73 73 span><span class
03d0: 3d 22 62 67 20 73 5f 62 74 6e 5f 77 72 22 3e 3c ="bg s_btn_wr"><
03e0: 69 6e 70 75 74 20 74 79 70 65 3d 73 75 62 6d 69 input type=submi
03f0: 74 20 69 64 3d 73 75 20 76 61 6c 75 65 3d e7 99 t id=su value=..
0400: be e5 ba a6 e4 b8 80 e4 b8 8b 20 63 6c 61 73 73 .......... class
<= Recv data, 1341 bytes (0x53d)
0000: 3d 22 62 67 20 73 5f 62 74 6e 22 3e 3c 2f 73 70 ="bg s_btn"></sp
0010: 61 6e 3e 20 3c 2f 66 6f 72 6d 3e 20 3c 2f 64 69 an> </form> </di
0020: 76 3e 20 3c 2f 64 69 76 3e 20 3c 64 69 76 20 69 v> </div> <div i
0030: 64 3d 75 31 3e 20 3c 61 20 68 72 65 66 3d 68 74 d=u1> <a href=ht
0040: 74 70 3a 2f 2f 6e 65 77 73 2e 62 61 69 64 75 2e tp://news.baidu.
0050: 63 6f 6d 20 6e 61 6d 65 3d 74 6a 5f 74 72 6e 65 com name=tj_trne
0060: 77 73 20 63 6c 61 73 73 3d 6d 6e 61 76 3e e6 96 ws class=mnav>..
0070: b0 e9 97 bb 3c 2f 61 3e 20 3c 61 20 68 72 65 66 ....</a> <a href
0080: 3d 68 74 74 70 3a 2f 2f 77 77 77 2e 68 61 6f 31 =http://www.hao1
0090: 32 33 2e 63 6f 6d 20 6e 61 6d 65 3d 74 6a 5f 74 23.com name=tj_t
00a0: 72 68 61 6f 31 32 33 20 63 6c 61 73 73 3d 6d 6e rhao123 class=mn
00b0: 61 76 3e 68 61 6f 31 32 33 3c 2f 61 3e 20 3c 61 av>hao123</a> <a
00c0: 20 68 72 65 66 3d 68 74 74 70 3a 2f 2f 6d 61 70  href=http://map
00d0: 2e 62 61 69 64 75 2e 63 6f 6d 20 6e 61 6d 65 3d .baidu.com name=
00e0: 74 6a 5f 74 72 6d 61 70 20 63 6c 61 73 73 3d 6d tj_trmap class=m
00f0: 6e 61 76 3e e5 9c b0 e5 9b be 3c 2f 61 3e 20 3c nav>......</a> <
0100: 61 20 68 72 65 66 3d 68 74 74 70 3a 2f 2f 76 2e a href=http://v.
0110: 62 61 69 64 75 2e 63 6f 6d 20 6e 61 6d 65 3d 74 baidu.com name=t
0120: 6a 5f 74 72 76 69 64 65 6f 20 63 6c 61 73 73 3d j_trvideo class=
0130: 6d 6e 61 76 3e e8 a7 86 e9 a2 91 3c 2f 61 3e 20 mnav>......</a> 
0140: 3c 61 20 68 72 65 66 3d 68 74 74 70 3a 2f 2f 74 <a href=http://t
0150: 69 65 62 61 2e 62 61 69 64 75 2e 63 6f 6d 20 6e ieba.baidu.com n
0160: 61 6d 65 3d 74 6a 5f 74 72 74 69 65 62 61 20 63 ame=tj_trtieba c
0170: 6c 61 73 73 3d 6d 6e 61 76 3e e8 b4 b4 e5 90 a7 lass=mnav>......
0180: 3c 2f 61 3e 20 3c 6e 6f 73 63 72 69 70 74 3e 20 </a> <noscript> 
0190: 3c 61 20 68 72 65 66 3d 68 74 74 70 3a 2f 2f 77 <a href=http://w
01a0: 77 77 2e 62 61 69 64 75 2e 63 6f 6d 2f 62 64 6f ww.baidu.com/bdo
01b0: 72 7a 2f 6c 6f 67 69 6e 2e 67 69 66 3f 6c 6f 67 rz/login.gif?log
01c0: 69 6e 26 61 6d 70 3b 74 70 6c 3d 6d 6e 26 61 6d in&amp;tpl=mn&am
01d0: 70 3b 75 3d 68 74 74 70 25 33 41 25 32 46 25 32 p;u=http%3A%2F%2
01e0: 46 77 77 77 2e 62 61 69 64 75 2e 63 6f 6d 25 32 Fwww.baidu.com%2
01f0: 66 25 33 66 62 64 6f 72 7a 5f 63 6f 6d 65 25 33 f%3fbdorz_come%3
0200: 64 31 20 6e 61 6d 65 3d 74 6a 5f 6c 6f 67 69 6e d1 name=tj_login
0210: 20 63 6c 61 73 73 3d 6c 62 3e e7 99 bb e5 bd 95  class=lb>......
0220: 3c 2f 61 3e 20 3c 2f 6e 6f 73 63 72 69 70 74 3e </a> </noscript>
0230: 20 3c 73 63 72 69 70 74 3e 64 6f 63 75 6d 65 6e  <script>documen
0240: 74 2e 77 72 69 74 65 28 27 3c 61 20 68 72 65 66 t.write('<a href
0250: 3d 22 68 74 74 70 3a 2f 2f 77 77 77 2e 62 61 69 ="http://www.bai
0260: 64 75 2e 63 6f 6d 2f 62 64 6f 72 7a 2f 6c 6f 67 du.com/bdorz/log
0270: 69 6e 2e 67 69 66 3f 6c 6f 67 69 6e 26 74 70 6c in.gif?login&tpl
0280: 3d 6d 6e 26 75 3d 27 2b 20 65 6e 63 6f 64 65 55 =mn&u='+ encodeU
0290: 52 49 43 6f 6d 70 6f 6e 65 6e 74 28 77 69 6e 64 RIComponent(wind
02a0: 6f 77 2e 6c 6f 63 61 74 69 6f 6e 2e 68 72 65 66 ow.location.href
02b0: 2b 20 28 77 69 6e 64 6f 77 2e 6c 6f 63 61 74 69 + (window.locati
02c0: 6f 6e 2e 73 65 61 72 63 68 20 3d 3d 3d 20 22 22 on.search === ""
02d0: 20 3f 20 22 3f 22 20 3a 20 22 26 22 29 2b 20 22  ? "?" : "&")+ "
02e0: 62 64 6f 72 7a 5f 63 6f 6d 65 3d 31 22 29 2b 20 bdorz_come=1")+ 
02f0: 27 22 20 6e 61 6d 65 3d 22 74 6a 5f 6c 6f 67 69 '" name="tj_logi
0300: 6e 22 20 63 6c 61 73 73 3d 22 6c 62 22 3e e7 99 n" class="lb">..
0310: bb e5 bd 95 3c 2f 61 3e 27 29 3b 3c 2f 73 63 72 ....</a>');</scr
0320: 69 70 74 3e 20 3c 61 20 68 72 65 66 3d 2f 2f 77 ipt> <a href=//w
0330: 77 77 2e 62 61 69 64 75 2e 63 6f 6d 2f 6d 6f 72 ww.baidu.com/mor
0340: 65 2f 20 6e 61 6d 65 3d 74 6a 5f 62 72 69 69 63 e/ name=tj_briic
0350: 6f 6e 20 63 6c 61 73 73 3d 62 72 69 20 73 74 79 on class=bri sty
0360: 6c 65 3d 22 64 69 73 70 6c 61 79 3a 20 62 6c 6f le="display: blo
0370: 63 6b 3b 22 3e e6 9b b4 e5 a4 9a e4 ba a7 e5 93 ck;">...........
0380: 81 3c 2f 61 3e 20 3c 2f 64 69 76 3e 20 3c 2f 64 .</a> </div> </d
0390: 69 76 3e 20 3c 2f 64 69 76 3e 20 3c 64 69 76 20 iv> </div> <div 
03a0: 69 64 3d 66 74 43 6f 6e 3e 20 3c 64 69 76 20 69 id=ftCon> <div i
03b0: 64 3d 66 74 43 6f 6e 77 3e 20 3c 70 20 69 64 3d d=ftConw> <p id=
03c0: 6c 68 3e 20 3c 61 20 68 72 65 66 3d 68 74 74 70 lh> <a href=http
03d0: 3a 2f 2f 68 6f 6d 65 2e 62 61 69 64 75 2e 63 6f ://home.baidu.co
03e0: 6d 3e e5 85 b3 e4 ba 8e e7 99 be e5 ba a6 3c 2f m>............</
03f0: 61 3e 20 3c 61 20 68 72 65 66 3d 68 74 74 70 3a a> <a href=http:
0400: 2f 2f 69 72 2e 62 61 69 64 75 2e 63 6f 6d 3e 41 //ir.baidu.com>A
0410: 62 6f 75 74 20 42 61 69 64 75 3c 2f 61 3e 20 3c bout Baidu</a> <
0420: 2f 70 3e 20 3c 70 20 69 64 3d 63 70 3e 26 63 6f /p> <p id=cp>&co
0430: 70 79 3b 32 30 31 37 26 6e 62 73 70 3b 42 61 69 py;2017&nbsp;Bai
0440: 64 75 26 6e 62 73 70 3b 3c 61 20 68 72 65 66 3d du&nbsp;<a href=
0450: 68 74 74 70 3a 2f 2f 77 77 77 2e 62 61 69 64 75 http://www.baidu
0460: 2e 63 6f 6d 2f 64 75 74 79 2f 3e e4 bd bf e7 94 .com/duty/>.....
0470: a8 e7 99 be e5 ba a6 e5 89 8d e5 bf 85 e8 af bb ................
0480: 3c 2f 61 3e 26 6e 62 73 70 3b 20 3c 61 20 68 72 </a>&nbsp; <a hr
0490: 65 66 3d 68 74 74 70 3a 2f 2f 6a 69 61 6e 79 69 ef=http://jianyi
04a0: 2e 62 61 69 64 75 2e 63 6f 6d 2f 20 63 6c 61 73 .baidu.com/ clas
04b0: 73 3d 63 70 2d 66 65 65 64 62 61 63 6b 3e e6 84 s=cp-feedback>..
04c0: 8f e8 a7 81 e5 8f 8d e9 a6 88 3c 2f 61 3e 26 6e ..........</a>&n
04d0: 62 73 70 3b e4 ba ac 49 43 50 e8 af 81 30 33 30 bsp;...ICP...030
04e0: 31 37 33 e5 8f b7 26 6e 62 73 70 3b 20 3c 69 6d 173...&nbsp; <im
04f0: 67 20 73 72 63 3d 2f 2f 77 77 77 2e 62 61 69 64 g src=//www.baid
0500: 75 2e 63 6f 6d 2f 69 6d 67 2f 67 73 2e 67 69 66 u.com/img/gs.gif
0510: 3e 20 3c 2f 70 3e 20 3c 2f 64 69 76 3e 20 3c 2f > </p> </div> </
0520: 64 69 76 3e 20 3c 2f 64 69 76 3e 20 3c 2f 62 6f div> </div> </bo
0530: 64 79 3e 20 3c 2f 68 74 6d 6c 3e 0d 0a          dy> </html>..
== Info: Connection #0 to host www.baidu.com left intact
[root@backup01 local]# 

 

curl www.baidu.com 和  curl -X GET www.baidu.com是一样的默认就是GET

 

 

 

 

 

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/576664.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

机器学习笔记(四)——最大似然估计

一、最大似然估计的基本思想 最大似然估计的基本思想是&#xff1a;从样本中随机抽取n个样本&#xff0c;而模型的参数估计量使得抽取的这n个样本的观测值的概率最大。最大似然估计是一个统计方法&#xff0c;它用来求一个样本集的概率密度函数的参数。 二、似然估计 在讲最…

Log4j 入门总结

一、Log4j介绍 log4j是类似于java.util.logging的日志作用&#xff0c;即记录一些有用信息&#xff0c;是一个日志框架&#xff1b; log4j log for Java 日志框架的作用&#xff1a; (1)函数参数是否正确&#xff1b; (2)软件发布后&#xff0c;记录用户的每一步操作&#xff…

ElasticSearch API文档查看

elastic官方API文档&#xff1a;https://www.elastic.co/guide/en/elasticsearch/reference/current/docs.html

机器学习笔记(五)——朴素贝叶斯分类

一、分类问题 分类实际上是我们在日常生活中经常使用的。比如说&#xff0c;在工作中&#xff0c;把自己手头的任务分为轻重缓急&#xff0c;然后按照优先级去完成它们。 朴素贝叶斯法是基于贝叶斯定理与特征条件独立假设的分类方法。 从数学的角度看C{c1,c2,…,ck}是类别的…

delphi函数,识别字符集编码

纪念不用 Delphi 开发7周年函数&#xff0c;获取web page文本&#xff0c;识别字符集编码&#xff1b;1 function CreateHttpRequest(proxyServer: string ; proxyPort: integer 0):2 TIdHTTP;3 function DecodeHttpRequestText(InString: string): string;4 implementatio…

取消Win7关机时的补丁更新

取消Win7关机时的补丁更新作者&#xff1a;三好 阅读&#xff1a; 30037人文&#xff1a;陕西 三好 Windows操作系统一直是在缝缝补补中前行的&#xff0c;Win7也不例外。由于系统自带的更新更安全更可靠&#xff0c;所以好多朋友都喜欢使用&#xff0c;如果将系统默认的“自动…

jdk下载

oracle官网&#xff1a;https://developer.oracle.com/java/ 一直往下拉到最低部 这里选择你需要的历史版本&#xff0c;我就选择 安装就不用我多说了&#xff0c;和以前安装jdk一样安装&#xff0c;配置环境变量

机器学习笔记(五)续——朴素贝叶斯算法的后验概率最大化含义

上一节中讲了朴素贝叶斯算法将实例分到后验概率最大的类。这等价于期望风险最小化。 假设使用0-1损失函数&#xff1a; L(Y,f(X)){1,0,Y≠f(X)Yf(X)L(Y, f(X)) = \Bigg\{ \begin{array} {ll}1, & Y \neq f(X) \\0, & Y = f(X)\end{array}上式中的f(x)是分类决策函数…

项目管理汇总

一、一个失败软件项目的思考 http://kb.cnblogs.com/page/113051/ 二、我们需要真正的软件项目经理 http://wangacidlemon.iteye.com/blog/1185903 评论写的不错&#xff0c;粘贴来先给大家分享一下 一个好的项目负责人&#xff0c;是不会自己去做具体事情的&#xff0c;他应…

ElasticSearch和solr的对比

关于ES&#xff1a;ElasticSearch是一个事实分布式搜索和分析引擎&#xff0c;使用其可以以前所未有的速度处理大数据&#xff0c;他用于全文搜索、结构化搜索、分析以及将这三者混合使用。维基百科使用ElasticSearch提供全文搜索并高亮关键字&#xff0c;以及输入实时搜索(sea…

机器学习笔记(六)——朴素贝叶斯法的参数估计

一、极大似然估计 在上一笔记中&#xff0c;经过推导&#xff0c;得到了朴素贝叶斯分类器的表示形式&#xff1a; yargmaxckP(Yck)∏jP(X(j)x(j)|Yck)(1)也就是说&#xff0c;朴素贝叶斯方法的学习是对概率P(Yck)和P(X(j)x(j)|Yck)的估计。故可以用极大似然估计法估计上述先验…

ElasticSearch和mysql对比

以员工文档 的形式存储为例&#xff1a;一个文档代表一个员工数据。存储数据到 ElasticSearch 的行为叫做索引&#xff0c;但在索引一个文档之前&#xff0c;需要确定将文档存储在哪里。一个 ElasticSearch 集群可以包含多个 索引&#xff0c;相应的每个索引可以包含多个类型 。…

最优化学习笔记(一)——牛顿法(一维搜索方法)

一、一维搜索方法 讨论目标函数为一元单值函数f:R→R时的最优化问题的迭代求解方法。 二、局部极小点的条件 n元实值函数f的一阶导数Df为&#xff1a; Df≜[∂f∂x1,∂f∂x2,…,∂f∂xn]Df \triangleq \lbrack \frac{\partial f}{\partial x_1}, \frac{\partial f}{\partia…

针对12306.cn网站应用架够的一些看法

临近年终&#xff0c;公司请来一位讲师来给我们作培训&#xff0c;题目记得是设计匠艺。说实话&#xff0c;我做不到像讲师那样&#xff0c;快讲完课时能将自己所讲的内容都有条理整理一遍。我就大致讲讲我所做笔记的一些内容吧。总的来说这位讲师的实践经验很丰富&#xff0c;…

机器学习笔记(七)——决策树模型

引言 决策树&#xff08;Decision Tree&#xff09;是一种基本的分类和回归方法。它的扩展方法有GBDT和GBRT 等。决策树模型的学习过程主要有特征选择、决策树生成和剪枝。主要算法有ID3、C4.5和CART等。 一、决策树模型 决策树首先是一个树形结构&#xff0c;它包括两种类型…

ElasticSearch获取多个文档Multi GET API介绍

#■同时获取多个文档信息 #■例子:获职index:bank和shakespeare下面 #. I0为1.2.3.4.15.6.28的文档信息 GET /bank/bank_account/1 GET /bank/bank_account/2 GET /shakespcare/line/3 GET /bank/bank_account/4 GET /shakespeare/line/15 #日数组[] GET /_mget {"docs&qu…

机器学习笔记(八)——决策树模型的特征选择

一、引言 决策树构建过程中的特征选择是非常重要的一步。特征选择是决定用哪个特征来划分特征空间&#xff0c;特征选择是要选出对训练数据集具有分类能力的特征&#xff0c;这样可以提高决策树的学习效率。如果利用某一个特征进行分类与随机分类的结果没有很大的差别&#xf…

Bulk批量操作API的介绍

#多重模式 #批量操作bulk POST /library/books/_bulk {"index": {"_id": 1}} {"title":"Elasticsearch: The Definitive Guide","price":5} {"index": {"_id": 2}} {"title":"The Elast…

[转】:Android调试工具及方法

http://www.cnblogs.com/feisky/archive/2010/01/01/1637566.html--LogcatDump一份系统消息的日志。这些消息包括模拟器抛出错误时的堆栈跟踪。Android Log一个记录日志的类&#xff0c;用来将消息写入模拟器上的日志文件中。如果你在DDMS上运行logcat的话你可以就实时查看消息…

机器学习笔记(九)——决策树的生成与剪枝

一、决策树的生成算法 基本的决策树生成算法主要有ID3和C4.5, 它们生成树的过程大致相似&#xff0c;ID3是采用的信息增益作为特征选择的度量&#xff0c;而C4.5采用信息增益比。构建过程如下&#xff1a; 从根节点开始&#xff0c;计算所有可能的特征的信息增益&#xff08;信…