請求
curl -s -v -H "Frank: xxx" -- "https://www.baidu.com"
對各個命令不了解的可以去explainshell.com查詢
得到
GET / HTTP/1.1 ----請求 根目錄 http請求 HTTP請求的1.1版本
Host: www.baidu.com ---訪問的是百度
User-Agent: curl/7.54.0 ---用的是curl的7.54.0來訪問的
Accept: /----不做任何限制
Frank: xxx ---是誰訪問的
curl -X POST -s -v -H "Frank: xxx" -- "https://www.baidu.com"
請求的內(nèi)容為
POST / HTTP/1.1
Host: www.baidu.com
User-Agent: curl/7.54.0
Accept: /
Frank: xxx
curl -X POST -d "1234567890" -s -v -H "Frank: xxx" -- "https://www.baidu.com"
請求的內(nèi)容為
POST / HTTP/1.1
Host: www.baidu.com
User-Agent: curl/7.54.0
Accept: /
Frank: xxx
Content-Length: 10
Content-Type: application/x-www-form-urlencoded
1234567890 --數(shù)據(jù)
用 Chrome 發(fā)請求
打開 Network
地址欄輸入網(wǎng)址
在 Network 點(diǎn)擊刹前,查看 request,點(diǎn)擊「view source」
終于點(diǎn)了?可以看到請求的前三部分了
如果有請求的第四部分酷鸦,那么在 FormData 或 Payload 里面可以看到
響應(yīng)
HTTP/1.1 200 OK
Accept-Ranges: bytes
Cache-Control: private, no-cache, no-store, proxy-revalidate, no-transform
Connection: Keep-Alive
Content-Length: 2443
Content-Type: text/html
Date: Tue, 10 Oct 2017 09:14:05 GMT
Etag: "5886041d-98b"
Last-Modified: Mon, 23 Jan 2017 13:24:45 GMT
Pragma: no-cache
Server: bfe/1.0.8.18
Set-Cookie: BDORZ=27315; max-age=86400; domain=.baidu.com; path=/
<!DOCTYPE html>
<html> <head> 后面太長,省略了……
用 Chrome 查看響應(yīng)
打開 Network
輸入網(wǎng)址
選中第一個響應(yīng)
查看 Response Headers,點(diǎn)擊「view source」
你會看到響應(yīng)的前兩部分
查看 Response 或者 Preview,你會看到響應(yīng)的第 4 部分