Convert curl commands to Python, JavaScript and more

Convert curl to Python, JavaScript and more

Fork me on GitHub

curl command

Examples: GET - POST - JSON - Basic Auth - Files - Form
#include <curl/curl.h>

int main(int argc, char *argv[])
{
  CURLcode ret;
  CURL *hnd;

  hnd = curl_easy_init();
  curl_easy_setopt(hnd, CURLOPT_BUFFERSIZE, 102400L);
  curl_easy_setopt(hnd, CURLOPT_URL, "http://example.com");
  curl_easy_setopt(hnd, CURLOPT_NOPROGRESS, 1L);
  curl_easy_setopt(hnd, CURLOPT_USERAGENT, "curl/8.2.1");
  curl_easy_setopt(hnd, CURLOPT_MAXREDIRS, 50L);
  curl_easy_setopt(hnd, CURLOPT_HTTP_VERSION, (long)CURL_HTTP_VERSION_2TLS);
  curl_easy_setopt(hnd, CURLOPT_FTP_SKIP_PASV_IP, 1L);
  curl_easy_setopt(hnd, CURLOPT_TCP_KEEPALIVE, 1L);

  ret = curl_easy_perform(hnd);

  curl_easy_cleanup(hnd);
  hnd = NULL;

  return (int)ret;
}

curl from Google Chrome

  1. Open the Network tab in the DevTools
  2. Right click (or Ctrl-click) a request
  3. Click "Copy" → "Copy as cURL""Copy as cURL (bash)"
  4. Paste it in the curl command box above

This also works in Safari and Firefox.

Warning: 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.

curl from Safari

  1. Open the Network tab in the Developer Tools
  2. Right click (or Ctrl-click or two-finger click) a request
  3. Click "Copy as cURL" in the dropdown menu
  4. Paste it in the curl command box above

This also works in Chrome and Firefox.

Warning: 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.

curl from Firefox

  1. Open the Network Monitor tab in the Developer Tools
  2. Right click (or Ctrl-click) a request
  3. Click "Copy" → "Copy as cURL"
  4. Paste it in the curl command box above

This also works in Chrome and Safari.

Warning: 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.

Privacy

We do not transmit or record the curl commands you enter or what they're converted to. This is a static website (hosted on GitHub Pages) and the conversion happens entirely in your browser using JavaScript.

There is also a VS Code extension and a command line tool you can install from npm with

npm install -g curlconverter

Similar Tools

Support Us

GitHub is matching all contributions to this project on GitHub Sponsors.

Contribute Now

Found a problem?

Please report bugs on GitHub.