{"componentChunkName":"component---src-templates-post-template-jsx","path":"/works/posts/2020-11-05--001","result":{"data":{"site":{"siteMetadata":{"title":"Blog by Eunyoung","subtitle":"작업 기록 블로그","copyright":"© All rights reserved.","author":{"name":"EunYoung","twitter":"#"},"disqusShortname":"","url":"https://ssongey.github.io"}},"markdownRemark":{"id":"546f59cc-78c9-5071-a08c-26692b67055d","html":"<p><span class=\"title__sub1\">CURL ?</span><br/>\n다양한 프로토콜을 지원하는 데이터 전송용 Command Line Tool 이다.\n(Http, Https, FTP, SFTP, SMTP 등을 지원)</p>\n<p><span class=\"title__sub1\">GET</span></p>\n<div class=\"gatsby-highlight\" data-language=\"cmd\"><pre class=\"language-cmd\"><code class=\"language-cmd\">$ curl -d &quot;key1=value&amp;key2=value2&quot; -H &quot;Content-Type: application/x-www-form-urlencoded&quot; -X GET http://localhost:8080/data&quot;</code></pre></div>\n<p><span class=\"title__sub1\">POST</span></p>\n<div class=\"gatsby-highlight\" data-language=\"cmd\"><pre class=\"language-cmd\"><code class=\"language-cmd\"># x-www-form-urlencoded\n$ curl -H &quot;Content-Type: application/x-www-form-urlencoded&quot; -d &quot;key1=value&amp;key2=value2&quot; -X POST http://localhost:8080/data&quot;\n\n# application/json\n$ curl -H &quot;Content-Type: application/json&quot; -d &#39;{&quot;key1&quot;:&quot;value&quot;, &quot;key2&quot;:&quot;value2&quot;} -X POST http://localhost:8080/data&quot;</code></pre></div>\n<p><span class=\"title__sub1\">옵션 정리</span>\n<span class=\"title__sub2\">http의 메소드를 지정 [ -X ]</span></p>\n<div class=\"gatsby-highlight\" data-language=\"cmd\"><pre class=\"language-cmd\"><code class=\"language-cmd\">$ curl -X [PUT|GET|POST] http://www.example.net</code></pre></div>\n<p><span class=\"title__sub2\">response header 확인 [ -I, i ]</span></p>\n<div class=\"gatsby-highlight\" data-language=\"cmd\"><pre class=\"language-cmd\"><code class=\"language-cmd\"># 헤더만 출력\n$ curl -I http://www.example.net\n\n# header와 body 둘다 출력\n$ curl -i http://www.example.net</code></pre></div>\n<p><span class=\"title__sub2\">SSL 인증서 에러 무시 [ -k ]</span></p>\n<div class=\"gatsby-highlight\" data-language=\"cmd\"><pre class=\"language-cmd\"><code class=\"language-cmd\">$ curl -k https://www.example.net</code></pre></div>\n<p><span class=\"title__sub2\">output [ -o ]</span></p>\n<div class=\"gatsby-highlight\" data-language=\"cmd\"><pre class=\"language-cmd\"><code class=\"language-cmd\">$ curl -o /dev/null http://www.example.net</code></pre></div>\n<p><span class=\"title__sub2\">특정 포맷에 맞게 write [ -w ]</span></p>\n<div class=\"gatsby-highlight\" data-language=\"cmd\"><pre class=\"language-cmd\"><code class=\"language-cmd\"># status code 출력\n$ curl -w &#39;%{http_code}\\n&#39; http://www.example.net</code></pre></div>\n<p><span class=\"title__sub2\">진척상황 표시하지 않기 [ -s ]</span></p>\n<div class=\"gatsby-highlight\" data-language=\"cmd\"><pre class=\"language-cmd\"><code class=\"language-cmd\"># 에러도 표시되지 않음\n$ curl -s https://www.example.net\n\n# 에러는 표시\n$ curl -sS https://www.example.net</code></pre></div>\n<p><span class=\"title__sub2\">프록시 이용시 [ -x, —proxy ]</span></p>\n<div class=\"gatsby-highlight\" data-language=\"cmd\"><pre class=\"language-cmd\"><code class=\"language-cmd\">$ curl --proxy &lt;proxyip&gt;:&lt;port&gt; http://www.example.net\n$ curl -x &lt;proxyip&gt;:&lt;port&gt; http://www.example.net\n\n$ curl -x &lt;proxyip&gt;:&lt;port&gt; --proxy-user &lt;username&gt;:&lt;password&gt; http://www.example.net\n$ curl -x &lt;username&gt;:&lt;password&gt;@&lt;proxyip&gt;:&lt;port&gt; http://www.example.net</code></pre></div>\n<p><span class=\"title__sub2\">최대접속시간제한을 설정 [ —connect-timeout ]</span></p>\n<div class=\"gatsby-highlight\" data-language=\"cmd\"><pre class=\"language-cmd\"><code class=\"language-cmd\">$ curl --connect-timeout 600 http://www.example.net</code></pre></div>","fields":{"tagSlugs":["/tags/curl/"],"slug":"/works/posts/2020-11-05--001"},"frontmatter":{"title":"[CURL] curl 사용법","tags":["curl"],"date":"2020-11-05","description":""}}},"pageContext":{"slug":"/works/posts/2020-11-05--001"}},"staticQueryHashes":[]}