-
Notifications
You must be signed in to change notification settings - Fork 40
/
index.html
278 lines (264 loc) · 14.6 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="Utility for converting cURL commands to code">
<meta name="author" content="Nick Carneiro">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-title" content="curlconverter">
<meta name="format-detection" content="telephone=no">
<meta name="mobile-web-app-capable" content="yes">
<link rel="icon" href="favicon.ico" type="image/x-icon">
<link rel="apple-touch-icon" href="/apple-touch-icon.png">
<link rel="manifest" href="/site.webmanifest">
<link href="/main.css" rel="stylesheet">
<title>Convert curl commands to code</title>
</head>
<body>
<div class="container py-2">
<div class="row">
<div class="col-8 col-sm-10 col-md-11">
<h3 class="text-muted d-none d-md-block">Convert <a href="https://curl.se/docs/manual.html"><code>curl</code></a> commands to Python, JavaScript, PHP, R, Go, Rust, Elixir, Java, MATLAB, Dart, CFML, Ansible URI, Strest or JSON</h3>
<h3 class="text-muted d-block d-md-none">Convert <a href="https://curl.se/docs/manual.html"><code>curl</code></a> to Python, JavaScript and more</h3>
</div>
</div>
</div>
<a class="github-fork-ribbon right-top" href="https://github.com/curlconverter/curlconverter" data-ribbon="Fork me on GitHub" title="Fork me on GitHub">Fork me on GitHub</a>
<div class="container-xl pb-4">
<div class="row pb-3">
<div class="col-12 col-sm-5 order-1">
<h2 class="mb-sm-0"><code>curl</code> command</h2>
</div>
<div class="col-12 col-sm-6 col-xl-7 order-3 order-sm-2 pt-sm-3 text-end">
<small class="examples align-top">
Examples:
<a id="get-example" href="#">GET</a>
-
<a id="post-example" href="#">POST</a>
-
<a id="basic-auth-example" href="#">Basic Auth</a>
</small>
</div>
<div class="col-12 order-2 order-sm-3 pb-sm-3">
<textarea id="curl-code" class="form-control" placeholder="curl example.com" rows=6 autofocus spellcheck="false" autocorrect="off" autocapitalize="none"></textarea>
</div>
</div>
<div class="row pb-1 pb-lg-0" role="navigation">
<div class="col-sm-auto d-none d-sm-block d-xl-none py-1">
<h2>Language:</h2>
</div>
<div class="col col-sm-auto d-xl-none px-sm-0">
<select class="form-select form-select-lg" id="language-select">
<option value="ansible">Ansible</option>
<option value="cfml">ColdFusion ML</option>
<option value="dart">Dart</option>
<option value="elixir">Elixir</option>
<option value="go">Go</option>
<option value="java">Java</option>
<option value="javascript">JavaScript</option>
<option value="json">JSON</option>
<option value="node-fetch">Node.js (node-fetch)</option>
<option value="node-axios">Node.js (axios)</option>
<option value="node-request">Node.js (request)</option>
<option value="matlab">MATLAB</option>
<option value="php">PHP</option>
<option value="python" selected>Python</option>
<option value="r">R</option>
<option value="rust">Rust</option>
<option value="strest">Strest</option>
</select>
</div>
<ul class="nav nav-tabs d-none d-xl-flex px-3" id="language-navbar">
<li class="nav-item">
<a class="nav-link" href="#ansible">Ansible</a>
</li>
<li class="nav-item">
<a class="nav-link nav-link-outbound" href="https://everything.curl.dev/libcurl/libcurl">
<!--! Font Awesome Pro 6.1.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2022 Fonticons, Inc. -->
C <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path d="M256 64C256 46.33 270.3 32 288 32H415.1C415.1 32 415.1 32 415.1 32C420.3 32 424.5 32.86 428.2 34.43C431.1 35.98 435.5 38.27 438.6 41.3C438.6 41.35 438.6 41.4 438.7 41.44C444.9 47.66 447.1 55.78 448 63.9C448 63.94 448 63.97 448 64V192C448 209.7 433.7 224 416 224C398.3 224 384 209.7 384 192V141.3L214.6 310.6C202.1 323.1 181.9 323.1 169.4 310.6C156.9 298.1 156.9 277.9 169.4 265.4L338.7 96H288C270.3 96 256 81.67 256 64V64zM0 128C0 92.65 28.65 64 64 64H160C177.7 64 192 78.33 192 96C192 113.7 177.7 128 160 128H64V416H352V320C352 302.3 366.3 288 384 288C401.7 288 416 302.3 416 320V416C416 451.3 387.3 480 352 480H64C28.65 480 0 451.3 0 416V128z"/></svg>
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#cfml" title="ColdFusion Markup Language">CFML</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#dart">Dart</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#elixir">Elixir</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#go">Go</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#java">Java</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#javascript">JavaScript</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#json">JSON</a>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" data-bs-toggle="dropdown" href="#" role="button" aria-expanded="false">Node.js</a>
<ul class="dropdown-menu">
<li><a class="dropdown-item" href="#node-fetch">node-fetch</a></li>
<li><a class="dropdown-item" href="#node-axios">axios</a></li>
<li><a class="dropdown-item" href="#node-request">request</a></li>
</ul>
</li>
<li class="nav-item">
<a class="nav-link" href="#matlab">MATLAB</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#php">PHP</a>
</li>
<li class="nav-item">
<a class="nav-link active" href="#python">Python</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#r">R</a>
</li>
<li class="nav-item">
<a class="nav-link nav-link-outbound" href="https://jhawthorn.github.io/curl-to-ruby/">
Ruby <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path d="M256 64C256 46.33 270.3 32 288 32H415.1C415.1 32 415.1 32 415.1 32C420.3 32 424.5 32.86 428.2 34.43C431.1 35.98 435.5 38.27 438.6 41.3C438.6 41.35 438.6 41.4 438.7 41.44C444.9 47.66 447.1 55.78 448 63.9C448 63.94 448 63.97 448 64V192C448 209.7 433.7 224 416 224C398.3 224 384 209.7 384 192V141.3L214.6 310.6C202.1 323.1 181.9 323.1 169.4 310.6C156.9 298.1 156.9 277.9 169.4 265.4L338.7 96H288C270.3 96 256 81.67 256 64V64zM0 128C0 92.65 28.65 64 64 64H160C177.7 64 192 78.33 192 96C192 113.7 177.7 128 160 128H64V416H352V320C352 302.3 366.3 288 384 288C401.7 288 416 302.3 416 320V416C416 451.3 387.3 480 352 480H64C28.65 480 0 451.3 0 416V128z"/></svg>
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#rust">Rust</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#strest">Strest</a>
</li>
</ul>
</div>
<div class="row">
<div class="col">
<pre><code id="generated-code"></code></pre>
</div>
</div>
<div class="row">
<div id="copy-to-clipboard" class="text-end"><a href="#">Copy to clipboard</a></div>
<div style="display: none;" id="issue-promo">If your syntax is correct, create a
<a href="https://github.com/curlconverter/curlconverter/issues/new" target="_blank">new blank issue</a> <span style="display: none;" id="prefilled-issue"> or one <a href="" target="_blank">prefilled with the current input</a></span>
</div>
</div>
<div class="row">
<div id="warnings-container" class="col pt-3" style="display: none;">
<pre><code id="warnings" style="display: block;"></code></pre>
</div>
</div>
</div>
<div class="container-md pb-4">
<div class="row border-top py-4" id="chrome">
<div class="col-lg-4">
<h3><code>curl</code> from Google Chrome</h3>
<ol>
<li>Open the <a href="https://developer.chrome.com/docs/devtools/network/">Network</a> tab in the <a href="https://developer.chrome.com/docs/devtools/overview/">DevTools</a></li>
<li>Right click (or Ctrl-click) a request</li>
<li>Click "Copy" → <span class="not-windows">"Copy as cURL"</span><span class="windows d-none">"Copy as cURL (<b>bash</b>)"</span></li>
<li>Paste it in the <b><code>curl</code> command</b> box above</li>
</ol>
<p>
This also works in <a class="to-safari" href="#">Safari</a> and <a class="to-firefox" href="#">Firefox</a>.
</p>
<p class="d-none d-lg-block pt-3">
<b>Warning</b>: the copied command may contain cookies or other sensitive data. Be careful if you're sharing the command with other people, sending someone your cookie for a website is like sending them your password.
</p>
</div>
<div class="col-lg-8">
<img class="screenshot img-fluid mx-auto d-block" src="/images/chrome.png" srcset="/images/chrome@2x.png 2x" alt="screenshot of the Chrome DevTools">
</div>
</div>
<div class="row border-top py-4 d-none" id="safari">
<div class="col-lg-4">
<h3><code>curl</code> from Safari</h3>
<ol>
<li>Open the <a href="https://support.apple.com/en-us/guide/safari-developer/dev1f3525e58/mac">Network</a> tab in the <a href="https://support.apple.com/en-us/guide/safari-developer/dev073038698/mac">Developer Tools</a></li>
<li>Right click (or Ctrl-click or two-finger click) a request</li>
<li>Click "Copy as cURL" in the dropdown menu</li>
<li>Paste it in the <b><code>curl</code> command</b> box above</li>
</ol>
<p>
This also works in <a class="to-chrome" href="#">Chrome</a> and <a class="to-firefox" href="#">Firefox</a>.
</p>
<p class="d-none d-lg-block pt-3">
<b>Warning</b>: the copied command may contain cookies or other sensitive data. Be careful if you're sharing the command with other people, sending someone your cookie for a website is like sending them your password.
</p>
</div>
<div class="col-lg-8">
<img class="screenshot img-fluid mx-auto d-block" src="/images/safari.png" srcset="/images/safari@2x.png 2x" alt="screenshot of the Safari dev tools">
</div>
</div>
<div class="row border-top py-4 d-none" id="firefox">
<div class="col-lg-4">
<h3><code>curl</code> from Firefox</h3>
<ol>
<li>Open the <a href="https://developer.mozilla.org/en-US/docs/Tools/Network_Monitor">Network Monitor</a> tab in the <a href="https://developer.mozilla.org/en-US/docs/Tools">Developer Tools</a></li>
<li>Right click (or Ctrl-click) a request</li>
<li>Click "Copy" → "Copy as cURL"</li>
<li>Paste it in the <b><code>curl</code> command</b> box above</li>
</ol>
<p>
This also works in <a class="to-chrome" href="#">Chrome</a> and <a class="to-safari" href="#">Safari</a>.
</p>
<p class="d-none d-xl-block pt-3">
<b>Warning</b>: the copied command may contain cookies or other sensitive data. Be careful if you're sharing the command with other people, sending someone your cookie for a website is like sending them your password.
</p>
</div>
<div class="col-lg-8">
<img class="screenshot img-fluid mx-auto d-block" src="/images/firefox.png" srcset="/images/firefox@2x.png 2x" alt="screenshot of the Firefox dev tools">
</div>
</div>
<div class="row border-top pt-4">
<div class="col-sm-12 col-md-4">
<h3>Privacy</h3>
<p>
We do <b>not</b> transmit or record the <code>curl</code> commands you enter or what they're converted to.
This is a static website (hosted on <a href="https://pages.github.com/">GitHub Pages</a>) and the conversion happens <a href="https://github.com/curlconverter/curltorequests/blob/master/index.js">entirely in your browser</a> using JavaScript.
</p>
<p class="pt-lg-2">
There is also <a href="https://marketplace.visualstudio.com/items?itemName=curlconverter.curlconverter">a VS Code extension</a> and a command line tool you can install from <a href="https://www.npmjs.com/package/curlconverter">npm</a> with
</p>
</p>
<code>npm install -g curlconverter</code>
</p>
</div>
<div class="col-sm-6 col-md-4">
<h3>Related Tools</h3>
<ul>
<li><a href="https://mholt.github.io/curl-to-go/">curl-to-Go</a></li>
<li><a href="https://incarnate.github.io/curl-to-php/">curl-to-PHP</a></li>
<li><a href="https://jhawthorn.github.io/curl-to-ruby/">curl-to-ruby</a></li>
<li><a href="https://mattcg.github.io/har-to-curl/">HAR-to-curl</a></li>
<li><a href="https://ryan.govost.es/http-translator/">http-translator</a> (to Python and JS)</li>
<li><code>curl</code>'s <a href="https://everything.curl.dev/libcurl/libcurl">--libcurl</a> (to C)</li>
<li><a href="https://github.com/spulec/uncurl">uncurl</a> (to Python)</li>
<li><a href="https://github.com/hrbrmstr/curlconverter">hrbrmstr/curlconverter</a> (to R)</li>
<li><a href="https://github.com/postmanlabs/curl-to-postman">Postman</a>, <a href="https://github.com/Kong/insomnia/blob/develop/packages/insomnia-importers/README.md">Insomnia</a> and <a href="https://github.com/luckymarmot/Paw-cURLImporter">Paw</a></li>
<li><a href="https://github.com/ofw/curlify">curlify</a> (Python to <code>curl</code>)</li>
</ul>
</div>
<div class="col-sm-6 col-md-4">
<div class="row">
<h3>Support Us</h3>
<div class="well larger-text pb-3 pb-sm-4">
<p>GitHub is matching all contributions to this project on <a href="https://github.com/sponsors/NickCarneiro">Github Sponsors</a>.</p>
<a class="btn btn-primary" href="https://github.com/sponsors/NickCarneiro">
Contribute Now
</a>
</div>
<h3>Found a problem?</h3>
<div>
Please report bugs
<a href="https://github.com/curlconverter/curlconverter/issues/new">on GitHub</a>.
</div>
</div>
</div>
</div>
</div>
<script src="/main.js"></script>
</body>
</html>