本文へスキップ

cURL 変換ツール — cURL を fetch・Python・Go・PHP に

cURL コマンドを fetch、Node、Python requests、Go、PHP、axios のコードに変換。メソッド、ヘッダー、Cookie、ボディも解析。ブラウザで動作。

サンプル
cURL コマンド

リクエスト

POSThttps://api.example.com/v1/orders

クエリパラメータ

2
expand
items
limit
20

ヘッダー

2
Content-Type
application/json
Authorization
Bearer demo_7f3a9c2e41

Cookie

2
session
7d1f0c
theme
dark

ボディ

JSON
{
  "customer": "cus_42",
  "items": [
    {
      "sku": "KB-75",
      "qty": 1
    }
  ],
  "note": "It's a gift"
}

オプション

圧縮(--compressed)
// Browsers drop forbidden headers (Cookie, Host, Referer…).
// For cookies, use credentials: "include" instead.

// Browser manual redirects return an opaque response; the 3xx status and body are unavailable.
const response = await fetch("https://api.example.com/v1/orders?expand=items&limit=20", {
  redirect: "manual",
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "Authorization": "Bearer demo_7f3a9c2e41",
    "Cookie": "session=7d1f0c; theme=dark"
  },
  body: JSON.stringify({
    "customer": "cus_42",
    "items": [
      {
        "sku": "KB-75",
        "qty": 1
      }
    ],
    "note": "It's a gift"
  })
});

console.log(response.status, await response.text());

POST · 25 行 · 警告: 0何も送信されません

ブラウザ内で動作します。コマンドは解析するだけで実行せず、リクエストも送信しません。

形式の参考資料

ツールページの更新日: