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,一经查实,立即删除!

相关文章

ElasticSearch API文档查看

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

取消Win7关机时的补丁更新

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

jdk下载

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

ElasticSearch和solr的对比

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

ElasticSearch和mysql对比

以员工文档 的形式存储为例&#xff1a;一个文档代表一个员工数据。存储数据到 ElasticSearch 的行为叫做索引&#xff0c;但在索引一个文档之前&#xff0c;需要确定将文档存储在哪里。一个 ElasticSearch 集群可以包含多个 索引&#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…

Bulk批量操作API的介绍

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

elasticsearch内部版本控制

现在我将这个price价格改为10&#xff0c;看下版本有什么变化&#xff1f; 获取一下 返回结果我们知道价格price已经修改为10&#xff0c;_version已经变成2 我们把参数version改成2试试 我们从执行结果可知&#xff0c;我们已经修改成功&#xff0c;并且版本自增为3

最优化学习笔记(三)——梯度下降法

本来这周计划写下逻辑回归的学习笔记&#xff0c;但是其中用到了最优化对数似然函数&#xff0c;因此决定先复习下梯度方法和拟牛顿法。本节先从纯数学的角度总结下梯度下降法。 一、柯西-施瓦茨不等式 对于 Rn中的任意两个向量 x和y&#xff0c; 有&#xff1a; |<x,y&g…

ElasticSearch外部版本控制

#外部版本控制机制| PUT /library/books/1?version5&version_typeexternal {"title": "Elosticsearch: The Definitive Guide" ,"name":{"first" : "Zachary","last" : "Tong"},"publish_dat…

ElasticSearch映射Mapping

1.1 什么是映射 (1) 映射(mapping): 定义index的元数据, 指定要索引并存储的文档的字段类型. 也就是说映射决定了Elasticsearch在建立倒排索引、进行检索时对文档采取的相关策略, 如数字类型、日期类型、文本类型等等. 需要注意的是: 检索时用到的分析策略, 要和建立索引时的分…

机器学习笔记(十)——Logistic Function AND Softmax Function

一、说明 在逻辑回归和一些机器学习算法中&#xff0c; Logistic函数和Softmax函数是常用到的&#xff0c;今天就先讨论下这两个函数。 二、Logistic Function Logistic function一般用于二分类问题&#xff0c;它的函数定义如下&#xff1a; f(x)11e−x(1)f(x) = \frac{1}{1…

kibana客户端工具操作ElasticSearch(增删改查三)

之前一直我们讲的是添加文档和查看文档&#xff0c;下面我们看下怎么修改文档&#xff0c; 第一种方式PUT 覆盖原来的文档 修改文档&#xff08;覆盖原来的&#xff09;&#xff1a; PUT /lib/user/1 {"first_name":"Jane","last_name":"…

Word2Vec学习笔记(三)

三、Hierarchical Softmax模型 3.1 词向量 词向量目前常用的有2种表示方法&#xff0c;One-hot representation 和 distributed representation. 词向量&#xff0c;顾名思义就是将一个词表示为向量的形式&#xff0c;一个词&#xff0c;怎么可以将其表现为向量呢&#xff1f;…

Word2Vec学习笔记(三)续

三、&#xff08;续&#xff09;Skip-gram模型介绍 Skip-gram模型并不是和CBOW模型相反的&#xff0c;它们的目的都是计算出词的向量&#xff0c;只不过在作者的论文中给出的图看样子是反的而已。Skip-gram模型是用每个当前词去预测一定范围内除当前词之外前后的词。同样的&…

ElasticSearch关于映射mapping介绍

#首先我们还是先增加几个文档 PUT /myindex/article/1 {"post_date": "2020-03-14","title": "Java","content": "java is the best language","author_id": 119 }PUT /myindex/article/2 {"post…

ElasticSearch的Object数据类型

上一篇mapping文章我们知道数字类型和日期类型要精确查找&#xff0c;以及mapping的两个重要的作用。 所以创建索引的时候,是不是可以预先定义字段的类型以及相关属性&#xff0c;这样就能够把日期字段处理成日期&#xff0c;把数字字段处理成数字&#xff0c;把字符串字段处理…

Word2Vec学习笔记(四)——Negative Sampling 模型

前面讲了Hierarchical softmax 模型&#xff0c;现在来说说Negative Sampling 模型的CBOW和Skip-gram的原理。它相对于Hierarchical softmax 模型来说&#xff0c;不再采用huffman树&#xff0c;这样可以大幅提高性能。 一、Negative Sampling 在负采样中&#xff0c;对于给定…