1. Go to this page and download the library: Download anlutro/curl library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
anlutro / curl example snippets
$curl = new anlutro\cURL\cURL;
$response = $curl->get('http://www.google.com');
// easily build an url with a query string
$url = $curl->buildUrl('http://www.google.com', ['s' => 'curl']);
$response = $curl->get($url);
// the post, put and patch methods takes an array of POST data
$response = $curl->post($url, ['api_key' => 'my_key', 'post' => 'data']);
// add "json" to the start of the method to convert the data to a JSON string
// and send the header "Content-Type: application/json"
$response = $curl->jsonPost($url, ['post' => 'data']);
// if you don't want any conversion to be done to the provided data, for example
// if you want to post an XML string, add "raw" to the start of the method
$response = $curl->rawPost($url, '<?xml version...');
// raw request are also the easiest way to upload files
$file = curl_file_create('/path/to/file');
$response = $curl->rawPost($url, ['file' => $file]);
// a response object is returned
var_dump($response->statusCode); // response status code integer (for example, 200)
var_dump($response->statusText); // full response status (for example, '200 OK')
echo $response->body;
var_dump($response->headers); // array of headers
var_dump($response->info); // array of curl info