Convert Curl to PHP
Convert curl commands into ready-to-run Python, JavaScript fetch, Node axios, PHP and Go code — locally in your browser.
Processed entirely in your browser — nothing you enter here is ever uploaded.
Result
About this tool
This page opens the converter with PHP preselected: paste a command-line curl call and get the equivalent php-curl code — curl_init(), a series of curl_setopt() calls and curl_exec() with the status code read via curl_getinfo(). The naming is no coincidence: PHP's curl extension wraps the very same libcurl library the command-line tool is built on, so every flag has a direct CURLOPT_* counterpart.
The mapping is one-to-one: the URL goes to CURLOPT_URL, -X to CURLOPT_CUSTOMREQUEST, -H lines into a CURLOPT_HTTPHEADER array, -d payloads into CURLOPT_POSTFIELDS as a string, -u into CURLOPT_USERPWD, and -F file fields become an array with new CURLFile(...) so PHP produces a genuine multipart upload. CURLOPT_RETURNTRANSFER is always set, so the response comes back as a string instead of being echoed.
This is the fastest way to integrate a payment gateway, CRM or any REST API whose documentation only shows curl examples into a WordPress plugin, Laravel job or plain PHP script. Parsing happens locally in your browser, so commands with live merchant keys stay on your machine.
Example. The command curl https://example.com in the fetch target becomes a fetch GET call to that URL.
Limit. Parsed flags are the request, header, data, user, form, json, cookie, user-agent, referer and output family; retry, proxy and insecure-TLS flags are not translated.