{"id":10284,"date":"2023-03-28T10:53:28","date_gmt":"2023-03-28T02:53:28","guid":{"rendered":"http:\/\/123.57.164.21\/?p=10284"},"modified":"2023-03-28T11:02:37","modified_gmt":"2023-03-28T03:02:37","slug":"curl-g-%e5%92%8c-get%e7%9a%84%e5%8c%ba%e5%88%ab","status":"publish","type":"post","link":"https:\/\/92it.top\/?p=10284","title":{"rendered":"curl \u7684\u4e00\u4e9btips"},"content":{"rendered":"\n<p><strong>curl -G \u548c-GET\u7684\u533a\u522b<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p>curl \u547d\u4ee4\u4e2d\u7684 <code>-G<\/code> \u53c2\u6570\u548c <code>-GET<\/code> \u53c2\u6570\u90fd\u8868\u793a\u53d1\u9001 HTTP GET \u8bf7\u6c42\u7684\u610f\u601d\uff0c\u4f46\u5b83\u4eec\u7684\u5177\u4f53\u7528\u6cd5\u7565\u6709\u4e0d\u540c\u3002<\/p>\n\n\n\n<p><code>-G<\/code> \u53c2\u6570\u8868\u793a\u4f7f\u7528 HTTP GET \u65b9\u6cd5\u53d1\u9001\u8bf7\u6c42\uff0c\u4f46\u5b83\u8fd8\u6709\u4e00\u4e2a\u7279\u6b8a\u7684\u529f\u80fd\uff0c\u5c31\u662f\u5c06\u53c2\u6570\u4ee5 URL query string \u7684\u5f62\u5f0f\u53d1\u9001\u3002\u4f8b\u5982\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">curl -G --data-urlencode 'name=John' --data-urlencode 'age=25' http:\/\/example.com\/user\n<\/pre>\n\n\n\n<p>\u8fd9\u4e2a\u547d\u4ee4\u5c06\u4f1a\u5411 <a href=\"http:\/\/example.com\/user\">http:\/\/example.com\/user<\/a> \u53d1\u9001\u4e00\u4e2a HTTP GET \u8bf7\u6c42\uff0c\u8bf7\u6c42\u7684 URL \u4e3a <a href=\"http:\/\/example.com\/user?name=John&amp;age=25%E3%80%82%E5%85%B6%E4%B8%AD\">http:\/\/example.com\/user?name=John&amp;age=25\u3002\u5176\u4e2d<\/a> <code>--data-urlencode<\/code> \u53c2\u6570\u8868\u793a\u5bf9\u53c2\u6570\u8fdb\u884c URL \u7f16\u7801\u540e\u518d\u53d1\u9001\u3002<\/p>\n\n\n\n<p><code>-GET<\/code> \u53c2\u6570\u8868\u793a\u4f7f\u7528 HTTP GET \u65b9\u6cd5\u53d1\u9001\u8bf7\u6c42\uff0c\u4f46\u5b83\u5e76\u4e0d\u4f1a\u5c06\u53c2\u6570\u4ee5 URL query string \u7684\u5f62\u5f0f\u53d1\u9001\u3002\u5982\u679c\u9700\u8981\u53d1\u9001\u53c2\u6570\uff0c\u5fc5\u987b\u4f7f\u7528 <code>-d<\/code> \u53c2\u6570\u6307\u5b9a\u53c2\u6570\u7684\u952e\u503c\u5bf9\uff0c\u4f8b\u5982\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">curl -GET -d 'name=John' -d 'age=25' http:\/\/example.com\/user\n<\/pre>\n\n\n\n<p>\u8fd9\u4e2a\u547d\u4ee4\u5c06\u4f1a\u5411 <a href=\"http:\/\/example.com\/user\">http:\/\/example.com\/user<\/a> \u53d1\u9001\u4e00\u4e2a HTTP GET \u8bf7\u6c42\uff0c\u8bf7\u6c42\u7684 URL \u4e0d\u5e26\u53c2\u6570\uff0c\u4f46\u662f\u901a\u8fc7 <code>-d<\/code> \u53c2\u6570\u6307\u5b9a\u4e86\u4e24\u4e2a\u53c2\u6570 <code>name=John<\/code> \u548c <code>age=25<\/code>\u3002<\/p>\n\n\n\n<p>\u603b\u4e4b\uff0c<code>-G<\/code> \u53c2\u6570\u66f4\u9002\u5408\u53d1\u9001\u5e26\u6709\u53c2\u6570\u7684 HTTP GET \u8bf7\u6c42\uff0c\u800c <code>-GET<\/code> \u53c2\u6570\u5219\u66f4\u9002\u5408\u53d1\u9001\u4e0d\u5e26\u53c2\u6570\u7684 HTTP GET \u8bf7\u6c42\u3002\u4f46\u662f\u5b9e\u9645\u4e0a\uff0c<code>-GET<\/code> \u53c2\u6570\u5df2\u7ecf\u88ab\u5e9f\u5f03\u4e86\uff0c\u56e0\u6b64\u4e0d\u5efa\u8bae\u518d\u4f7f\u7528\u8be5\u53c2\u6570\u3002<\/p>\n\n\n\n<p><strong>curl -x\u662f\u4ec0\u4e48<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p><code>-x<\/code> \u662f curl \u547d\u4ee4\u4e2d\u7528\u4e8e\u6307\u5b9a\u4ee3\u7406\u670d\u52a1\u5668\u7684\u53c2\u6570\u3002\u5f53\u4f7f\u7528\u8be5\u53c2\u6570\u65f6\uff0ccurl \u5c06\u4f1a\u4f7f\u7528\u6307\u5b9a\u7684\u4ee3\u7406\u670d\u52a1\u5668\u6765\u53d1\u9001 HTTP \u8bf7\u6c42\uff0c\u800c\u4e0d\u662f\u76f4\u63a5\u53d1\u9001\u7ed9\u76ee\u6807\u670d\u52a1\u5668\u3002<\/p>\n\n\n\n<p><code>-x<\/code> \u53c2\u6570\u7684\u8bed\u6cd5\u5982\u4e0b\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">curl -x &lt;proxy> &lt;url>\n<\/pre>\n\n\n\n<p>\u5176\u4e2d\uff0c<code>&lt;proxy&gt;<\/code> \u662f\u4ee3\u7406\u670d\u52a1\u5668\u7684\u5730\u5740\u548c\u7aef\u53e3\u53f7\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u683c\u5f0f\uff1a<\/p>\n\n\n\n<ul><li><code>proxyserver:port<\/code>\uff1a\u6307\u5b9a\u4ee3\u7406\u670d\u52a1\u5668\u7684\u5730\u5740\u548c\u7aef\u53e3\u53f7\uff0c\u4f8b\u5982 <code>proxy.example.com:8080<\/code><\/li><li><code>http:\/\/proxyserver:port<\/code>\uff1a\u6307\u5b9a HTTP \u4ee3\u7406\u670d\u52a1\u5668\u7684\u5730\u5740\u548c\u7aef\u53e3\u53f7<\/li><li><code>socks5:\/\/proxyserver:port<\/code>\uff1a\u6307\u5b9a SOCKS5 \u4ee3\u7406\u670d\u52a1\u5668\u7684\u5730\u5740\u548c\u7aef\u53e3\u53f7<\/li><\/ul>\n\n\n\n<p><code>&lt;url&gt;<\/code> \u662f\u8981\u8bf7\u6c42\u7684 URL\u3002<\/p>\n\n\n\n<p>\u4f8b\u5982\uff0c\u4e0b\u9762\u7684\u547d\u4ee4\u5c06\u4f1a\u901a\u8fc7 <code>proxy.example.com:8080<\/code> \u8fd9\u4e2a\u4ee3\u7406\u670d\u52a1\u5668\u6765\u8bf7\u6c42 <code>http:\/\/example.com<\/code> \u8fd9\u4e2a URL\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">curl -x proxy.example.com:8080 http:\/\/example.com\n<\/pre>\n\n\n\n<p>\u5982\u679c\u4ee3\u7406\u670d\u52a1\u5668\u9700\u8981\u7528\u6237\u540d\u548c\u5bc6\u7801\u8fdb\u884c\u8eab\u4efd\u9a8c\u8bc1\uff0c\u5219\u53ef\u4ee5\u4f7f\u7528 <code>--proxy-user<\/code> \u53c2\u6570\u6307\u5b9a\u7528\u6237\u540d\u548c\u5bc6\u7801\uff0c\u4f8b\u5982\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">curl -x proxy.example.com:8080 --proxy-user username:password http:\/\/example.com\n<\/pre>\n\n\n\n<p>\u8fd9\u4e2a\u547d\u4ee4\u5c06\u4f1a\u4f7f\u7528 <code>proxy.example.com:8080<\/code> \u4ee3\u7406\u670d\u52a1\u5668\u6765\u8bf7\u6c42 <code>http:\/\/example.com<\/code>\uff0c\u5e76\u4f7f\u7528 <code>username<\/code> \u548c <code>password<\/code> \u8fdb\u884c\u8eab\u4efd\u9a8c\u8bc1\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>curl -G \u548c-GET\u7684\u533a\u522b curl \u547d\u4ee4\u4e2d\u7684 -G \u53c2\u6570\u548c -GET \u53c2\u6570\u90fd\u8868\u793a\u53d1\u9001 HTTP GET [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10],"tags":[],"_links":{"self":[{"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts\/10284"}],"collection":[{"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=10284"}],"version-history":[{"count":2,"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts\/10284\/revisions"}],"predecessor-version":[{"id":10287,"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts\/10284\/revisions\/10287"}],"wp:attachment":[{"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=10284"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=10284"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=10284"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}