{"id":294268,"date":"2024-11-10T12:12:53","date_gmt":"2024-11-10T04:12:53","guid":{"rendered":"https:\/\/lrxjmw.cn\/czlxdwqqgjjd.html"},"modified":"2024-11-10T12:12:53","modified_gmt":"2024-11-10T04:12:53","slug":"czlxdwqqgjjd","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/czlxdwqqgjjd.html","title":{"rendered":"Curl\uff1a\u6700\u6d41\u884c\u7684 web \u8bf7\u6c42\u5de5\u5177\uff0c\u7b80\u5355\u597d\u7528 YYDS"},"content":{"rendered":"

Curl\u662f\u6700\u6d41\u884c\u7684web\u6073\u6c42\u5de5\u5177\uff0c\u4e09\u5927\u4e3b\u6d41\u64cd\u4f5c\u7cfb\u7edf\u5e26\u6709curl\uff0c\u4e00\u4e9b\u624b\u673a\u8054\u901a\u7aef\u7cfb\u7edf\u4e5f\u63d0\u4f9b\u4e86curl\uff0c\u901a\u8fc7\u547d\u4ee4<\/a>\u884c\u4e0b\u8f7d\u6587\u4ef6\u548c\u53d1\u8d77\u7f51\u9875\u6073\u6c42\uff0c\u7b80\u5355\u597d\u7528YYDS\uff01<\/p>\n

Linux<\/a>curl\u547d\u4ee4\u6709\u4ec0\u4e48\u5e38\u89c1\u7528\u6cd5?<\/p>\n

curl\u662f\u6700\u6d41\u884c\u7684web\u6073\u6c42\u5de5\u5177\uff0c3\u5927\u4e3b\u6d41\u64cd\u4f5c\u7cfb\u7edf\u5e26\u6709curl\uff0c\u4e00\u4e9b\u624b\u673a\u8054\u901a\u7aef\u7cfb\u7edf\u4e5f\u63d0\u4f9b\u4e86curl\uff0c\u901a\u8fc7\u547d\u4ee4\u884c\u4e0b\u8f7d\u6587\u4ef6\u548c\u53d1\u8d77\u7f51\u9875\u6073\u6c42\uff0c\u7b80\u5355\u597d\u7528YYDS!<\/p>\n

curl\u662f\u4e00\u79cd\u4ece\u670d\u52a1\u5668\u4f20\u8f93\u6570\u636e\u6216\u5411\u670d\u52a1\u5668\u4f20\u8f93\u6570\u636e\u7684\u5de5\u5177\uff0c\u4f7f\u7528\u7684\u5408\u540c\u5305\u62ec\u5408\u540c(DICT\u3001FILE\u3001FTP\u3001FTPS\u3001GOPHER\u3001HTTP\u3001HTTPS\u3001IMAP\u3001imaps\u3001ldap\u3001ldaps\u3001pop3\u3001pop3s\u3001rtmp\u3001rtsp\u3001scp\u3001sftp\u3001smtp\u3001smtps\u3001TELNET\u548cTFTP)\u3002\u8be5\u547d\u4ee4\u65e0\u9700\u7528\u6237\u5e72\u9884\u3002<\/p>\n

curl\u63d0\u4f9b\u4e86\u5927\u91cf\u6709\u7528\u7684\u529f\u80fd\uff0c\u5982\u652f\u6301\u4ee3\u7406\u3001\u7528\u6237\u6388\u6743\u3001\u8bbf\u95eeFTP\u548cTFTP\u4e0a\u4f20\u4e0b\u8f7d\u3001HTTP\u6073\u6c42\u3001SSL\u8054\u63a5\u3001\u643a\u5e26Cookie\u3001\u6587\u4ef6\u4f20\u8f93\u65ad\u70b9\u7eed\u4f20\u3001Metalink\u6073\u6c42\u7b49\u3002\u6b63\u5982\u4f60\u5728\u4e0b\u6587\u4e2d\u89c1\u5230\u7684\uff0ccurl\u652f\u6301\u7684\u529f\u80fd\u582a\u79f0\u5927\u800c\u5168\u3002<\/p>\n

\u4e0b\u8f7d\u6587\u4ef6\u5939\u5230\u684c\u9762_\u4e0b\u8f7d\u6587\u4ef6\u53d8\u6210php\u600e\u4e48\u89e3\u51b3_linux curl \u4e0b\u8f7d\u6587\u4ef6<\/p>\n

curl\u8fd8\u63d0\u4f9b\u4e86libcurl\uff0c\u4ee5\u5e93\u7684\u65b9\u5f0f\u5c01\u88c5\u4e86\u6240\u6709\u4e0e\u4f20\u8f93\u76f8\u5173\u7684\u529f\u80fd\u3002<\/p>\n

\u4e0b\u8f7d\u6587\u4ef6\u5939\u5230\u684c\u9762_linux curl \u4e0b\u8f7d\u6587\u4ef6_\u4e0b\u8f7d\u6587\u4ef6\u53d8\u6210php\u600e\u4e48\u89e3\u51b3<\/p>\n

curl\u7684\u7528\u6cd5\u89c4\u5219<\/p>\n

curl\u547d\u4ee4\u51c6\u8bb8\u60a8\u5728Linux\u4e2d\u901a\u8fc7\u547d\u4ee4\u884c\u4e0b\u8f7d\u548c\u4e0a\u4f20\u6570\u636e\u3002\u5176\u53e5\u578b\u5982\u4e0b\uff1a<\/p>\n

\n

curl [options] [URL...]<\/code><\/pre>\n<\/p>\n

\u53ef\u901a\u8fc7curl--help\u547d\u4ee4linux\u64cd\u4f5c\u7cfb\u7edf\u5b89\u88c5\uff0c\u5982\u540c\u5927\u90e8\u4efd\u5176\u4ed6\u547d\u4ee4\u7684--help\u90a3\u6837linux curl \u4e0b\u8f7d\u6587\u4ef6<\/strong>\uff0c\u53ef\u4ee5\u81ea\u52a9\u67e5\u8be2\u8be5\u547d\u4ee4\u7684\u5e38\u89c1\u53c2\u6570\uff1a<\/p>\n

\n

 -d, --data  HTTP POST \u6570\u636e\n -f, --fail HTTP\u9519\u8bef\u65f6\u5b89\u9759\u5730\u5931\u8d25\uff08\u5b8c\u5168\u4e0d\u6253\u5370\u9519\u8bef\uff09\n -h, --help  \u83b7\u53d6\u547d\u4ee4\u5e2e\u52a9\n -i, --include \u5728\u8f93\u51fa\u4e2d\u5305\u542b\u534f\u8bae\u54cd\u5e94\u6807\u5934\n -o, --output  \u8f93\u51fa\u5199\u5165\u5230\u6587\u4ef6\u800c\u4e0d\u662f stdout\n -O, --remote-name \u5c06\u8f93\u51fa\u5199\u5165\u540d\u4e3a\u8fdc\u7a0b\u6587\u4ef6\u7684\u6587\u4ef6\u4e2d\n -s, --\u5b89\u9759\u6a21\u5f0f\n -T\uff0c--upload-file  \u5c06\u672c\u5730\u6587\u4ef6\u4f20\u8f93\u5230\u76ee\u7684\u5730\n -u, --user  \u670d\u52a1\u5668\u7528\u6237\u548c\u5bc6\u7801\n -A\u3001--user-agent  \u53d1\u9001 User-Agent  \u5230\u670d\u52a1\u5668\n -v\uff0c--verbose \u4f7f\u64cd\u7684\u4f5c\u53cd\u9988\u66f4\u52a0\u8be6\u5c3d\u663e\u793a\n -V, --version \u663e\u793a\u7248\u672c\u53f7<\/code><\/pre>\n<\/p>\n

--help\u503c\u663e\u793a\u90e8\u4efd\u53c2\u6570\u3002curl\u8fd8\u652f\u6301\u597d\u591a\u4e2d\u7ea7\u529f\u80fd\uff0cLinux\u4e0b\u53ef\u901a\u8fc7\uff1a<\/p>\n

\n

man curl<\/code><\/pre>\n<\/p>\n

\u547d\u4ee4\u67e5\u770b\u5b8c\u6574\u7684\u5e2e\u52a9\u6587\u6863\u5bf9curl\u6240\u6709\u53c2\u6570\u7684\u89e3\u91ca(\u6bd4\u5982\u8ffd\u968f\u91cd\u5b9a\u5411\u7684-L\u53c2\u6570\uff0c\u53ea\u5728mancurl\u7684\u5b8c\u6574\u5e2e\u52a9\u4fe1\u606f\u4e2d\u6709\u663e\u793a)\u3002<\/p>\n

\u901a\u8fc7\u4e0b\u8fb9\u7684\u4e8b\u4f8b\uff0c\u4f60\u53ef\u4ee5\u66f4\u76f4\u89c2\u5730\u4e86\u89e3curl\u7684\u5e38\u89c1\u529f\u80fd\u662f\u600e\u6837\u5de5\u4f5c\u7684\u3002<\/p>\n

\u95ee\u98981\uff1acurl\u547d\u4ee4\u600e\u4e48\u5de5\u4f5c?<\/p>\n

curl\u7684\u57fa\u672c\u7528\u6cd5\u76f8\u5f53\u7b80\u5355\u2014\u2014\u53ea\u9700\u5c06URL\u4f5c\u4e3a\u8f93\u5165\u4f20\u9012\u7ed9curl\u547d\u4ee4\uff0c\u4e4b\u540e\u5c06\u8f93\u51fa\u91cd\u5b9a\u5411\u5230\u6587\u4ef6\u5373\u53ef\u3002<\/p>\n

\u6bd4\u5982\uff0c\u5c06\u4e0b\u8f7d\u7684\u6587\u4ef6\u6570\u636e\u4fdd\u5b58\u4e3a\u672c\u5730\u7684ubuntu2204-64.torrent\u6587\u4ef6\uff1a<\/p>\n

\n

curl https:\/\/mirrors.aliyun.com\/ubuntu-releases\/23.04\/ubuntu-23.04-desktop-amd64.iso.torrent > ubuntu2204-64.torrent<\/code><\/pre>\n<\/p>\n

\u8bf7\u6ce8\u610f\uff0c\u60a8\u4e5f\u53ef\u4ee5\u5728\u6b64\u5904\u4f7f\u7528-o\u9009\u9879(\u4f5c\u4e3a\u5bf9\u6bd4\uff0clinux\u7684\u53e6\u4e00\u4e2a\u77e5\u540d\u4e0b\u8f7d\u5de5\u5177wget\u7684\u53c2\u6570\u662f-O,\u5927O\uff0c\u800ccurl\u7684\u662f\u5c0fo)\u3002<\/p>\n

\n

-o, --output \nWrite output to  instead of stdout.<\/code><\/pre>\n<\/p>\n

\u56de\u5230\u6211\u4eec\u7684\u793a\u4f8b\uff0c\u5f53\u6570\u636e\u4e0b\u8f7d\u5230\u7cfb\u7edf\u4e0a\u7684ubuntu2204-64.torrent\u6587\u4ef6\u4e2d\u65f6\uff0c\u5728\u547d\u4ee4\u884c\u4e0a\u751f\u6210\u4e86\u4ee5\u4e0b\u8f93\u51fa\uff1a<\/p>\n

\u5728\u64cd\u4f5c\u8fc7\u7a0b\u4e2d\uff0ccurl\u4e00\u822c\u4f1a\u663e\u793a\u8fdb\u5ea6\u8868\uff0c\u663e\u793a\u4f20\u8f93\u7684\u6570\u636e\u91cf\u3001\u4f20\u8f93\u901f\u7387\u548c\u9884\u8ba1\u5269\u4f59\u65f6\u95f4\u7b49\u3002<\/p>\n

\u9ed8\u8ba4\u60c5\u51b5\u4e0blinux curl \u4e0b\u8f7d\u6587\u4ef6<\/strong>\uff0ccurl\u4f1a\u5c06\u90a3\u4e9b\u6570\u636e\u663e\u793a\u5230\u7ec8\u7aef\u3002\u4f46\u82e5\u679c\u4f60\u8c03\u7528curl\u8fdb\u884c\u6587\u4ef6\u4e0b\u8f7d\u6216\u663e\u793a\u4e0b\u8f7d\u5185\u5bb9\u5230\u7ec8\u7aef\uff0c\u624d\u4f1a\u4e0d\u663e\u793a\u8fdb\u5ea6\u8868\uff0c\u4ee5\u514d\u628a\u8fdb\u5ea6\u8868\u548c\u54cd\u5e94\u6570\u636e\u6df7\u5728\u4e00\u8d77\u5317\u4eaclinux\u57f9\u8bad\uff0c\u6405\u4e71\u8f93\u51fa\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"

Curl\u662f\u6700\u6d41\u884c\u7684web\u8bf7\u6c42\u5de5\u5177\uff0c\u4e09\u5927\u4e3b\u6d41\u64cd\u4f5c\u7cfb\u7edf\u5e26\u6709curl\uff0c\u4e00\u4e9b\u624b\u673a\u79fb\u52a8\u7aef\u7cfb\u7edf\u4e5f\u63d0\u4f9b\u4e86curl\uff0c\u901a\u8fc7\u547d\u4ee4\u884c\u4e0b\u8f7d\u6587\u4ef6\u548c\u53d1\u8d77\u7f51\u9875\u8bf7\u6c42\uff0c\u7b80\u5355\u597d\u7528YYDS\uff01\u56de\u5230\u6211\u4eec\u7684\u793a\u4f8b\uff0c\u5f53\u6570\u636e\u4e0b\u8f7d\u5230\u7cfb\u7edf\u4e0a\u7684ubuntu2204-64.torrent\u6587\u4ef6\u4e2d\u65f6\uff0c\u5728\u547d\u4ee4\u884c\u4e0a\u751f\u6210\u4e86\u4ee5\u4e0b\u8f93\u51fa\uff1a<\/p>\n","protected":false},"author":1,"featured_media":294269,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[988],"tags":[4175],"class_list":["post-294268","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tougao","tag-chcsgjgnlxzg"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/294268","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=294268"}],"version-history":[{"count":0,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/294268\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/294269"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=294268"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=294268"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=294268"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}