1. Go to this page and download the library: Download icemont/curlwrapper 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/ */
use Icemont\cURL\CurlWrapper;
$curl = new CurlWrapper();
// Executing an empty POST request
var_dump($curl->postRequest('https://httpbin.org/post'));
// Add data and execute a POST request with data sending
$curl->addData('value', 'test')
->addData('value2', 'test2');
var_dump($curl->postRequest('https://httpbin.org/post'));
// Execute a simple GET request (data will be added as Query String)
var_dump($curl->getRequest('https://httpbin.org/get'));
// Reset the data and execute a simple GET request again
$curl->reset();
var_dump($curl->getRequest('https://httpbin.org/get'));
use Icemont\cURL\CurlWrapper;
$api = new CurlWrapper();
/**
* Adding data one by one
*/
$api->addHeader('X-API-Key: YOUR_API_KEY')
->addData('source', 'API')
->addData('name', 'Test User')
->addData('email', '[email protected]')
->addData('ip', '127.0.0.1');
/**
* Or immediately in the array
*/
$api->addDataFromArray([
'alert' => true,
'autorespond' => true,
'subject' => 'Testing API',
'message' => 'MESSAGE HERE',
]);
/**
* Executing the query as JSON
*/
var_dump($api->jsonRequest('https://support.example.com/api/tickets.json'));
echo 'Request response code: ' . $api->getLastCode() . PHP_EOL;
echo 'Request error string: ' . $api->getLastError() . PHP_EOL;
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.