{"id":1002,"date":"2019-04-25T12:11:25","date_gmt":"2019-04-25T04:11:25","guid":{"rendered":"https:\/\/www.linuxcool.com\/?p=1002"},"modified":"2022-05-06T17:27:38","modified_gmt":"2022-05-06T09:27:38","slug":"curl","status":"publish","type":"post","link":"https:\/\/www.linuxcool.com\/curl","title":{"rendered":"curl\u547d\u4ee4 – \u6587\u4ef6\u4f20\u8f93\u5de5\u5177"},"content":{"rendered":"\n

curl\u547d\u4ee4\u6765\u81ea\u4e8e\u82f1\u6587\u8bcd\u7ec4\u201dCommandLine URL\u201c\u7684\u7f29\u5199\uff0c\u5176\u529f\u80fd\u662f\u7528\u4e8e\u5728Shell\u7ec8\u7aef\u754c\u9762\u4e2d\u57fa\u4e8eURL\u89c4\u5219\u8fdb\u884c\u7684\u6587\u4ef6\u4f20\u8f93\u5de5\u4f5c\u3002curl\u662f\u4e00\u6b3e\u7efc\u5408\u7684\u4f20\u8f93\u5de5\u5177\uff0c\u53ef\u4ee5\u4e0a\u4f20\u4e5f\u53ef\u4ee5\u4e0b\u8f7d\uff0c\u652f\u6301HTTP\u3001HTTPS\u3001FTP\u7b49\u4e09\u5341\u4f59\u79cd\u5e38\u89c1\u534f\u8bae<\/p>\n\n\n\n

\u8bed\u6cd5\u683c\u5f0f\uff1a<\/strong>curl [\u53c2\u6570] \u7f51\u5740<\/p>\n\n\n\n

\u5e38\u7528\u53c2\u6570\uff1a<\/strong><\/p>\n\n\n\n

-o<\/td>\u6307\u5b9a\u65b0\u7684\u672c\u5730\u6587\u4ef6\u540d<\/td><\/tr>
-O<\/td>\u4fdd\u7559\u8fdc\u7a0b\u6587\u4ef6\u7684\u539f\u59cb\u540d<\/td><\/tr>
-u<\/td>\u901a\u8fc7\u670d\u52a1\u7aef\u914d\u7f6e\u7684\u7528\u6237\u540d\u548c\u5bc6\u7801\u6388\u6743\u8bbf\u95ee<\/td><\/tr>
-I<\/td>\u6253\u5370HTTP\u54cd\u5e94\u5934\u4fe1\u606f<\/td><\/tr>
-u<\/td>\u6307\u5b9a\u767b\u5f55\u8d26\u6237\u5bc6\u7801\u4fe1\u606f<\/td><\/tr>
-A<\/td>\u8bbe\u7f6e\u7528\u6237\u4ee3\u7406\u6807\u5934\u4fe1\u606f<\/td><\/tr>
-b<\/td>\u8bbe\u7f6e\u7528\u6237cookie\u4fe1\u606f<\/td><\/tr>
-C<\/td>\u652f\u6301\u65ad\u70b9\u7eed\u4f20<\/td><\/tr>
-s<\/td>\u9759\u9ed8\u6a21\u5f0f\uff0c\u4e0d\u8f93\u51fa\u4efb\u4f55\u4fe1\u606f<\/td><\/tr>
-T<\/td>\u4e0a\u4f20\u6587\u4ef6<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n

\u53c2\u8003\u5b9e\u4f8b<\/strong><\/p>\n\n\n\n

\u83b7\u53d6\u6307\u5b9a\u7f51\u7ad9\u7684\u7f51\u9875\u6e90\u7801\uff1a<\/p>\n\n\n\n

[root@linuxcool ~]# curl https:\/\/www.linuxcool.com<\/strong>\n  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current\n                                 Dload  Upload   Total   Spent    Left  Speed\n  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0\n<!DOCTYPE html>\n<html lang=\"zh-CN\">\n<head>\n<meta http-equiv=\"X-UA-Compatible\" content=\"IE=Edge\"\/>\n<meta charset=\"UTF-8\" \/>\n\u2026\u2026\u2026\u2026\u2026\u2026\u7701\u7565\u90e8\u5206\u8f93\u51fa\u4fe1\u606f\u2026\u2026\u2026\u2026\u2026\u2026<\/pre>\n\n\n\n

\u4e0b\u8f7d\u6307\u5b9a\u7f51\u7ad9\u4e2d\u7684\u6587\u4ef6\uff1a<\/p>\n\n\n\n

[root@linuxcool ~]# curl -O https:\/\/www.linuxprobe.com\/docs\/LinuxProbe.pdf<\/strong>\n  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current\n                                 Dload  Upload   Total   Spent    Left  Speed\n100 16.8M  100 16.8M    0     0  22.5M      0 --:--:-- --:--:-- --:--:-- 22.5M<\/pre>\n\n\n\n

\u6253\u5370\u6307\u5b9a\u7f51\u7ad9\u7684HTTP\u54cd\u5e94\u5934\u4fe1\u606f\uff1a<\/p>\n\n\n\n

[root@linuxcool ~]# curl -I https:\/\/www.linuxcool.com<\/strong>\n  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current\n                                 Dload  Upload   Total   Spent    Left  Speed\n  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0\nHTTP\/2 200 \nserver: Tengine\ncontent-type: text\/html; charset=UTF-8\nvary: Accept-Encoding\ndate: Wed, 04 May 2022 06:44:26 GMT\nvary: Accept-Encoding\nx-powered-by: PHP\/7.4.11\nvary: Accept-Encoding, Cookie\ncache-control: max-age=3, must-revalidate\nali-swift-global-savetime: 1651646666\nvia: cache3.l2cn1802[235,234,200-0,M], cache17.l2cn1802[236,0], kunlun10.cn257[403,414,200-0,M], kunlun\n2.cn257[417,0]\nx-cache: MISS TCP_REFRESH_MISS dirn:0:416601537\nx-swift-savetime: Wed, 04 May 2022 06:44:26 GMT\nx-swift-cachetime: 3\ntiming-allow-origin: *\neagleid: ab08f29616516466664417014e\n<\/pre>\n\n\n\n

\u4e0b\u8f7d\u6307\u5b9a\u6587\u4ef6\u670d\u52a1\u5668\u4e2d\u7684\u6587\u4ef6\uff08\u7528\u6237\u540d\uff1alinuxcool\uff0c\u5bc6\u7801\uff1aredhat\uff09\uff1a<\/p>\n\n\n\n

[root@linuxprobe ~]# curl -u linuxprobe:redhat ftp:\/\/www.linuxcool.com\/LinuxProbe.pdf<\/strong><\/pre>\n","protected":false},"excerpt":{"rendered":"

curl\u547d\u4ee4\u6765\u81ea\u4e8e\u82f1\u6587\u8bcd\u7ec4\u201dCommandLine URL\u201c\u7684\u7f29\u5199\uff0c\u5176\u529f\u80fd\u662f\u7528\u4e8e\u5728Shell\u7ec8\u7aef\u754c\u9762\u4e2d\u57fa\u4e8eUR […]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[4],"tags":[],"_links":{"self":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts\/1002"}],"collection":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/comments?post=1002"}],"version-history":[{"count":33,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts\/1002\/revisions"}],"predecessor-version":[{"id":9317,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts\/1002\/revisions\/9317"}],"wp:attachment":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/media?parent=1002"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/categories?post=1002"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/tags?post=1002"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}