Convert Curl Commands to PHP code Online

Curl command

Examples: GET - POST - JSON - Basic Auth - Files - Form

Curl to PHP Online

This tool helps you to generate PHP code based on Curl Command. Copy and Paste Curl Command and Generate PHP.

What can you do with Curl to PHP Converter Online?

  • Curl to PHP is very unique tool to convert curl command to http request of PHP. The input provide by the user's curl command to generate PHP Code.
  • This tool saves your time and helps to generate PHP code with ease.
  • Curl to PHP works well on Windows, MAC, Linux, Chrome, Firefox, Edge, and Safari.

what is Curl?

cURL is an open-source command line tool that downloads files from the web. It supports a variety of protocols, including HTTP, HTTPS, FTP, SFTP, TFTP, Gopher and others.

How do convert Curl to PHP code? 

Step1: Paste and convert your Curl requests to PHP code.
Step2: Copy PHP Code

Convert Curl to PHP Example

To use Curl in PHP code, you must first call the curl_init() method and then the curl_setopt() method to set all your parameters. After that, you need to execute the curl_exec() method to send the request. Below is an example PHP Curl request:

Curl
curl example.com
PHP Code
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://example.com');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');

$response = curl_exec($ch);

curl_close($ch);