Saltar al contenido

Convertidor cURL — cURL a fetch, Python, Go y PHP

Convierte comandos cURL a fetch de JavaScript, Node, Python requests, Go, PHP y axios. Ve el método, query, cabeceras, cookies y cuerpo. En tu navegador.

Ejemplos
Comando cURL

Petición

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

Parámetros de query

2
expand
items
limit
20

Cabeceras

2
Content-Type
application/json
Authorization
Bearer demo_7f3a9c2e41

Cookies

2
session
7d1f0c
theme
dark

Cuerpo

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

Opciones

Comprimido (--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 líneas · advertencias: 0No se envía nada

Se ejecuta en tu navegador. El comando se analiza, nunca se ejecuta, y no se hace ninguna petición.

Referencias de formatos

Página de la herramienta actualizada: