---
title: "cURL to PHP Converter: PHP cURL and Guzzle"
description: "Free curl to PHP converter: paste a curl command, get PHP curl_setopt_array or Guzzle code. Chrome and Windows copies, -F uploads, -d @file and gzip handled."
canonical: "https://browser-use.com/tools/curl-to-php"
last_updated: "2026-11-23"
---

# cURL to PHP Converter: PHP cURL and Guzzle

## cURL to PHP Converter

Convert a curl command to PHP cURL or Guzzle code that sends the same request. Files, uploads, gzip and quoting are handled. Flags it cannot convert are listed.

## How it works

### Copy the request as cURL

In Chrome, Edge or Firefox DevTools, right-click a request in the Network panel and choose Copy as cURL. Bash and Windows cmd copies work; use Bash for non-ASCII text.

### Pick PHP cURL or Guzzle

PHP cURL needs only the curl extension. Guzzle needs composer require guzzlehttp/guzzle.

### Run it

Save it as curl.php and run php curl.php. Files named with -d @ or -F are read when it runs.

### Why is -d a string, not an array?

An array in CURLOPT\_POSTFIELDS makes PHP send multipart/form-data. A string keeps the body curl sends, byte for byte.

Source: [PHP: curl\_setopt, CURLOPT\_POSTFIELDS](https://www.php.net/manual/en/function.curl-setopt.php)

### What happens to file uploads?

\-F file=@path becomes new CURLFile with the file name and type curl sends. Without them PHP sends the full local path as the file name.

Source: [PHP: CURLFile::\_\_construct](https://www.php.net/manual/en/curlfile.construct.php) · [php-src: ext/curl/interface.c](https://github.com/php/php-src/blob/PHP-8.3/ext/curl/interface.c#L1503)

### Is a gzip response decompressed?

Yes. --compressed becomes CURLOPT\_ENCODING => '', which asks for every encoding PHP's curl supports and decodes the reply.

Source: [libcurl: CURLOPT\_ACCEPT\_ENCODING](https://curl.se/libcurl/c/CURLOPT_ACCEPT_ENCODING.html)

### Can a $ in a token break the code?

No. Strings are single-quoted, or double-quoted with $ escaped when they hold control characters. Multi-line bodies become nowdoc blocks whose marker no line can end early.

Source: [PHP: nowdoc](https://www.php.net/manual/en/language.types.string.php#language.types.string.syntax.nowdoc)

### Is my command sent anywhere?

No. Conversion runs in this tab. Copied commands often carry cookies and tokens, so treat the code like a password.

## Request blocked?

Browser Use cloud browsers run a maintained Chromium fork with residential proxies.

[See stealth browsers](https://browser-use.com/stealth-browsers)

curl command

PHP library

PHP cURL (no dependency)Guzzle

Convert to PHPLoad example

---

BROWSER USE

- Browser Use Agents: give Browser Use a task and receive completed work. API V4 is current for new integrations.
- Browser Infrastructure: connect your agent or automation to managed browsers through SDK, REST, or CDP. Starts at $0.06/browser-hour.
- Developer tools: Open Source, Browser Harness, SDK, and MCP support the two products above.

[Developer Index](https://browser-use.com/index.md)
[Product Map](https://browser-use.com/llms.txt)
[Full Product Context](https://browser-use.com/llms-full.txt)
[Pricing](https://browser-use.com/pricing.md)
[Cloud Docs](https://docs.browser-use.com/cloud/quickstart)
[Open Source Docs](https://docs.browser-use.com/open-source/introduction)
