{"id":697,"date":"2025-12-09T17:33:25","date_gmt":"2025-12-09T09:33:25","guid":{"rendered":"https:\/\/www.52runoob.com\/?p=697"},"modified":"2025-12-09T17:33:25","modified_gmt":"2025-12-09T09:33:25","slug":"curl%e5%92%8cwget%e6%a3%80%e6%b5%8b%e7%bd%91%e9%a1%b5%e7%8a%b6%e6%80%81%e7%9a%84%e5%8c%ba%e5%88%ab","status":"publish","type":"post","link":"https:\/\/www.52runoob.com\/index.php\/2025\/12\/09\/curl%e5%92%8cwget%e6%a3%80%e6%b5%8b%e7%bd%91%e9%a1%b5%e7%8a%b6%e6%80%81%e7%9a%84%e5%8c%ba%e5%88%ab\/","title":{"rendered":"curl\u548cwget\u68c0\u6d4b\u7f51\u9875\u72b6\u6001\u7684\u533a\u522b"},"content":{"rendered":"\n<p>\u4e0b\u9762\u7ed9\u4f60\u6574\u7406\u4e00\u4efd <strong>\u300acurl \u548c wget \u68c0\u6d4b\u7f51\u9875\u72b6\u6001\u7684\u533a\u522b\u89e3\u6790\u300b<\/strong>\uff0c\u4ece\u529f\u80fd\u3001\u7528\u6cd5\u3001\u9002\u7528\u573a\u666f\u548c\u6ce8\u610f\u4e8b\u9879\u5168\u9762\u5206\u6790\u3002<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\"><strong>\u4e00\u3001\u57fa\u672c\u6982\u5ff5<\/strong><\/h1>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>\u5de5\u5177<\/th><th>\u529f\u80fd<\/th><\/tr><\/thead><tbody><tr><td><strong>curl<\/strong><\/td><td>\u547d\u4ee4\u884c\u4e0b\u7684 URL \u8bf7\u6c42\u5de5\u5177\uff0c\u652f\u6301 HTTP\/HTTPS\u3001FTP\u3001SMTP \u7b49\u591a\u79cd\u534f\u8bae\uff0c\u53ef\u53d1\u9001 GET\u3001POST\u3001PUT \u7b49\u8bf7\u6c42\uff0c\u8fd4\u56de\u54cd\u5e94\u5185\u5bb9\u6216\u72b6\u6001<\/td><\/tr><tr><td><strong>wget<\/strong><\/td><td>\u547d\u4ee4\u884c\u4e0b\u7684\u6587\u4ef6\u4e0b\u8f7d\u5de5\u5177\uff0c\u652f\u6301 HTTP\/HTTPS\/FTP\uff0c\u53ef\u9012\u5f52\u4e0b\u8f7d\u7f51\u9875\u3001\u955c\u50cf\u7f51\u7ad9\uff0c\u540c\u65f6\u652f\u6301\u65ad\u70b9\u7eed\u4f20\u548c\u7b80\u5355\u7684\u72b6\u6001\u68c0\u6d4b<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p><strong>\u6838\u5fc3\u533a\u522b<\/strong>\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>curl \u66f4\u9002\u5408 <strong>\u53d1\u9001\u8bf7\u6c42\u3001\u8c03\u8bd5\u63a5\u53e3\u3001\u68c0\u67e5\u54cd\u5e94\u5934\/\u72b6\u6001\u7801<\/strong><\/li>\n\n\n\n<li>wget \u66f4\u9002\u5408 <strong>\u4e0b\u8f7d\u6587\u4ef6\u3001\u7f51\u7ad9\u955c\u50cf\u3001\u6279\u91cf\u6293\u53d6<\/strong><\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\"><strong>\u4e8c\u3001curl \u68c0\u6d4b\u7f51\u9875\u72b6\u6001<\/strong><\/h1>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>1. \u57fa\u672c\u7528\u6cd5<\/strong><\/h3>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\ncurl -I https:\/\/example.com\n\n<\/pre><\/div>\n\n\n<ul class=\"wp-block-list\">\n<li><code>-I<\/code>\uff1a\u53ea\u8bf7\u6c42\u54cd\u5e94\u5934\uff0c\u4e0d\u4e0b\u8f7d\u5185\u5bb9<\/li>\n\n\n\n<li>\u8f93\u51fa\u793a\u4f8b\uff1a<\/li>\n<\/ul>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nHTTP\/1.1 200 OK\nDate: Mon, 09 Dec 2025 10:00:00 GMT\nContent-Type: text\/html\n\n<\/pre><\/div>\n\n\n<h3 class=\"wp-block-heading\"><strong>2. \u83b7\u53d6 HTTP \u72b6\u6001\u7801<\/strong><\/h3>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\ncurl -o \/dev\/null -s -w &quot;%{http_code}\\n&quot; https:\/\/example.com\n\n<\/pre><\/div>\n\n\n<ul class=\"wp-block-list\">\n<li><code>-o \/dev\/null<\/code>\uff1a\u5ffd\u7565\u54cd\u5e94\u4f53<\/li>\n\n\n\n<li><code>-s<\/code>\uff1a\u9759\u9ed8\u6a21\u5f0f\uff0c\u4e0d\u663e\u793a\u8fdb\u5ea6<\/li>\n\n\n\n<li><code>-w \"%{http_code}\"<\/code>\uff1a\u8f93\u51fa\u72b6\u6001\u7801<\/li>\n\n\n\n<li>\u8fd4\u56de\u793a\u4f8b\uff1a<code>200<\/code>\u3001<code>404<\/code>\u3001<code>500<\/code><\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>3. \u652f\u6301 POST \u8bf7\u6c42\u68c0\u6d4b<\/strong><\/h3>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\ncurl -X POST -d &quot;username=admin&amp;amp;password=123&quot; -I https:\/\/example.com\/login\n\n<\/pre><\/div>\n\n\n<ul class=\"wp-block-list\">\n<li>curl \u53ef\u4ee5\u65b9\u4fbf\u6a21\u62df\u63a5\u53e3\u8bf7\u6c42\uff0c\u8fd4\u56de\u72b6\u6001\u7801<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\"><strong>\u4e09\u3001wget \u68c0\u6d4b\u7f51\u9875\u72b6\u6001<\/strong><\/h1>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>1. \u57fa\u672c\u7528\u6cd5<\/strong><\/h3>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nwget --spider https:\/\/example.com\n\n<\/pre><\/div>\n\n\n<ul class=\"wp-block-list\">\n<li><code>--spider<\/code>\uff1a\u4e0d\u4e0b\u8f7d\u6587\u4ef6\uff0c\u53ea\u68c0\u67e5 URL \u53ef\u8bbf\u95ee\u6027<\/li>\n\n\n\n<li>\u8f93\u51fa\u793a\u4f8b\uff1a<\/li>\n<\/ul>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nSpider mode enabled. Check if remote file exists.\n--2025-12-09 10:05:00--  https:\/\/example.com\/\nResolving example.com... 93.184.216.34\nConnecting to example.com|93.184.216.34|:443... connected.\nHTTP request sent, awaiting response... 200 OK\nRemote file exists.\n\n<\/pre><\/div>\n\n\n<h3 class=\"wp-block-heading\"><strong>2. \u83b7\u53d6\u72b6\u6001\u7801<\/strong><\/h3>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nwget --spider -S https:\/\/example.com 2&gt;&amp;amp;1 | grep &quot;HTTP\/&quot;\n\n<\/pre><\/div>\n\n\n<ul class=\"wp-block-list\">\n<li><code>-S<\/code>\uff1a\u6253\u5370\u670d\u52a1\u5668\u54cd\u5e94\u5934<\/li>\n\n\n\n<li>\u8f93\u51fa\u793a\u4f8b\uff1a<\/li>\n<\/ul>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n  HTTP\/1.1 200 OK\n\n<\/pre><\/div>\n\n\n<h3 class=\"wp-block-heading\"><strong>3. \u652f\u6301\u9012\u5f52\u68c0\u6d4b<\/strong><\/h3>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nwget --spider -r https:\/\/example.com\n\n<\/pre><\/div>\n\n\n<ul class=\"wp-block-list\">\n<li>\u53ef\u68c0\u6d4b\u7f51\u7ad9\u4e2d\u6240\u6709\u94fe\u63a5\u662f\u5426\u53ef\u8bbf\u95ee<\/li>\n\n\n\n<li>\u9002\u5408\u7f51\u7ad9\u5065\u5eb7\u68c0\u67e5<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\"><strong>\u56db\u3001curl \u4e0e wget \u533a\u522b\u603b\u7ed3<\/strong><\/h1>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>\u7279\u6027<\/th><th>curl<\/th><th>wget<\/th><\/tr><\/thead><tbody><tr><td>\u529f\u80fd\u5b9a\u4f4d<\/td><td>\u8bf7\u6c42\/\u63a5\u53e3\u8c03\u8bd5<\/td><td>\u6587\u4ef6\/\u7f51\u7ad9\u4e0b\u8f7d<\/td><\/tr><tr><td>\u68c0\u6d4b\u72b6\u6001\u7801<\/td><td>\u2705 \u652f\u6301\u76f4\u63a5\u8f93\u51fa<\/td><td>\u2705 \u652f\u6301\uff0c\u4f46\u9700 <code>--spider -S<\/code><\/td><\/tr><tr><td>\u8bf7\u6c42\u7c7b\u578b<\/td><td>GET\u3001POST\u3001PUT\u3001DELETE \u7b49<\/td><td>\u4e3b\u8981 GET\uff08\u4e0d\u65b9\u4fbf POST\/PUT\uff09<\/td><\/tr><tr><td>\u9012\u5f52\/\u6279\u91cf<\/td><td>\u274c \u4e0d\u652f\u6301<\/td><td>\u2705 \u652f\u6301\u7f51\u7ad9\u94fe\u63a5\u9012\u5f52\u68c0\u67e5<\/td><\/tr><tr><td>\u8f93\u51fa\u63a7\u5236<\/td><td>\u53ef\u8f93\u51fa\u54cd\u5e94\u5934\u3001\u72b6\u6001\u7801\u3001\u6b63\u6587<\/td><td>\u8f93\u51fa\u5185\u5bb9\u4e3b\u8981\u7528\u4e8e\u65e5\u5fd7\/\u6587\u4ef6\u4e0b\u8f7d<\/td><\/tr><tr><td>\u4f9d\u8d56\u573a\u666f<\/td><td>API \u8c03\u8bd5\u3001\u670d\u52a1\u5668\u72b6\u6001\u68c0\u67e5<\/td><td>\u7f51\u7ad9\u955c\u50cf\u3001\u6279\u91cf\u5065\u5eb7\u68c0\u67e5<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\"><strong>\u4e94\u3001\u4f7f\u7528\u5efa\u8bae<\/strong><\/h1>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>\u68c0\u67e5\u5355\u4e2a URL \u72b6\u6001<\/strong>\uff1a\u7528 <code>curl -I<\/code> \u66f4\u7b80\u5355<\/li>\n\n\n\n<li><strong>\u6a21\u62df\u63a5\u53e3\u8bf7\u6c42 \/ POST \u8bf7\u6c42<\/strong>\uff1acurl \u66f4\u7075\u6d3b<\/li>\n\n\n\n<li><strong>\u6279\u91cf\u68c0\u6d4b\u7f51\u7ad9\u94fe\u63a5\u6216\u4e0b\u8f7d\u7f51\u9875<\/strong>\uff1awget \u66f4\u65b9\u4fbf<\/li>\n\n\n\n<li><strong>\u53ea\u83b7\u53d6\u72b6\u6001\u7801<\/strong>\uff1a\n<ul class=\"wp-block-list\">\n<li>curl\uff1a<code>curl -o \/dev\/null -s -w \"%{http_code}\" URL<\/code><\/li>\n\n\n\n<li>wget\uff1a<code>wget --spider -S URL 2>&amp;1 | grep \"HTTP\/\"<\/code><\/li>\n<\/ul>\n<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>\u4e0b\u9762\u7ed9\u4f60\u6574\u7406\u4e00\u4efd \u300acurl \u548c wget \u68c0\u6d4b\u7f51\u9875\u72b6\u6001\u7684\u533a\u522b\u89e3\u6790\u300b\uff0c\u4ece\u529f\u80fd\u3001\u7528&#8230; <a class=\"more-link\" href=\"https:\/\/www.52runoob.com\/index.php\/2025\/12\/09\/curl%e5%92%8cwget%e6%a3%80%e6%b5%8b%e7%bd%91%e9%a1%b5%e7%8a%b6%e6%80%81%e7%9a%84%e5%8c%ba%e5%88%ab\/\">Continue Reading &rarr;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[],"class_list":["post-697","post","type-post","status-publish","format-standard","hentry","category-2"],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.52runoob.com\/index.php\/wp-json\/wp\/v2\/posts\/697","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.52runoob.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.52runoob.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.52runoob.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.52runoob.com\/index.php\/wp-json\/wp\/v2\/comments?post=697"}],"version-history":[{"count":1,"href":"https:\/\/www.52runoob.com\/index.php\/wp-json\/wp\/v2\/posts\/697\/revisions"}],"predecessor-version":[{"id":698,"href":"https:\/\/www.52runoob.com\/index.php\/wp-json\/wp\/v2\/posts\/697\/revisions\/698"}],"wp:attachment":[{"href":"https:\/\/www.52runoob.com\/index.php\/wp-json\/wp\/v2\/media?parent=697"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.52runoob.com\/index.php\/wp-json\/wp\/v2\/categories?post=697"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.52runoob.com\/index.php\/wp-json\/wp\/v2\/tags?post=697"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}