1. Go to this page and download the library: Download adadgio/common 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/ */
adadgio / common example snippets
use Adadgio\Common\Http\Curl;
// GET request
$curl = new Curl();
$response = $curl
->get('http://example.com', array('query_param_1' => 'query param value'));
// or POST request with params
$curl = new Curl();
$response = $curl
->setContentType(Curl::JSON) // other options are JSON|XML|TEXT|FORL_URLENCODED|FORM_MULTIPART
->post('http://example.com', array('post_field_1' => 'psot field value'));
// POST request with more options
$curl = new Curl();
$response = $curl
->setContentType(Curl::JSON) // other options are JSON|XML|TEXT|FORL_URLENCODED|FORM_MULTIPART
->setAuthorizationBasic('Token', 'user', 'pass') // or ->setAuthorization('Basic', base64_encode('user:pass'))
// or ->setAuthorization('Token', yO3my4To3en)
->setCookies(true)
// ->addHeader('X-Custom-Header', 'CUst0mApiK3y')
->verifyHost(false) // or ->addOption(CURLOPT_SSL_VERIFYHOST, false)
->verifyPeer(true, "/home/my/server/cacert.pem") // second param is empty but you should set it in php.ini
->post('http://example.com', array('post_field_1' => 'psot field value'));