
How the curl converter reads your command
The converter splits the command the way a shell does. It handles single and double quotes, $'...' strings and line breaks from bash (\), Windows cmd (^) and PowerShell (backtick), and the command may start with curl or curl.exe. Parsing and code generation run in your browser.
Pick one of three outputs: Python 3 with requests, Node.js with axios, or PHP with its curl extension (curl_init and curl_setopt). Switching tabs rebuilds the code from the same command.
Before writing code, the converter drops the Content-Length, Host and Accept-Encoding headers. The library works out length and host from the request. For compression, requests and axios ask for gzip on their own, and PHP gets CURLOPT_ENCODING when the command has --compressed. A Cookie header or -b value goes into a cookies dict in Python. axios gets it back as a Cookie header, and PHP gets CURLOPT_COOKIE.
When to convert curl to Python or Node.js
- Your scraper has to send a request with the same headers and cookies the browser sent.
- A request works in Postman or DevTools, and you want it in a script without retyping a dozen headers.
- You compare how a site answers through a proxy and without one. Test the proxy in the online proxy checker first, so a dead IP does not look like a blocked request.
- You set the User-Agent with -A and need a current browser string. The User-Agent generator gives you one.
- You are learning requests or axios and want working code built from a request you know.
Example: cURL to Python requests
Press Example and the form loads a POST to https://httpbin.org/post with two headers (Accept and Content-Type: application/json), -b 'session=abc123', a --data-raw body of {"query":"proxy","page":1}, --compressed and a test proxy. The Python tab shows a headers dict with those two headers, cookies = {"session": "abc123"}, json_data = {"query": "proxy", "page": 1} and a proxies dict, then calls requests.post(url, headers=headers, cookies=cookies, json=json_data, proxies=proxies, allow_redirects=False). The code picks POST because the command has a body. --compressed adds no line here, since requests asks for gzip and unpacks the reply on its own. On the Node.js tab the same body turns into a JS object in data, next to an HttpsProxyAgent and maxRedirects: 0.
Supported curl flags in requests, axios and PHP
-X sets the method and -I sends HEAD. -H adds a header, and -A and -e turn into User-Agent and Referer headers. The body comes from -d, --data-raw, --data-binary and --data-urlencode; several -d values join with &. --json sets the body together with JSON Content-Type and Accept headers, and -G moves the data into the query string. -F name=value adds a form field, and -F file=@photo.jpg uploads a file: Python opens it into files=, axios appends it to a FormData, PHP wraps it in CURLFile. -u becomes auth= in requests, auth in axios and CURLOPT_USERPWD in PHP. -b sets cookies, -L turns on redirects and -k turns off certificate checks. -m sets the timeout, with --connect-timeout as a fallback when -m is absent. -x and -U carry the proxy and its login. Flags that change how curl itself saves output or retries, such as -o, -w and --retry, leave no trace in the code.
Using a proxy with Python requests and axios
The Proxy field takes ip:port, http://user:pass@ip:port, socks5://user:pass@ip:port or the ip:port:user:pass line many proxy sellers hand out. The converter rewrites ip:port:user:pass as http://user:pass@ip:port and URL-encodes the login and password, so a password with @ or # still works. Python gets a proxies dict with the same URL for http and https. axios gets an HttpsProxyAgent or SocksProxyAgent as httpAgent and httpsAgent, plus proxy: false, so axios ignores HTTP_PROXY variables from the environment. PHP passes the URL to CURLOPT_PROXY. For a SOCKS proxy the code opens with # pip install requests[socks] in Python or // npm install axios socks-proxy-agent in Node.js. To reformat a whole list, use the proxy list converter.