PHP code example of craftrac / paracurl

1. Go to this page and download the library: Download craftrac/paracurl 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/ */

    

craftrac / paracurl example snippets


PARACURL_<API_NAME>_BASEURL
PARACURL_<API_NAME>_USERNAME
PARACURL_<API_NAME>_PASSWORD
PARACURL_<API_NAME>_TOKEN

// Initialize Paracurl
$paracurl = new Paracurl('<API_NAME>', '<endpoint>');

// Send a GET request
$response = $paracurl->get();
$responseData = json_decode($response, true);

// Send a GET request with url data
$data = [
    'key' => 'value'
];
$response = $paracurl->get($data);
$responseData = json_decode($response, true);

// Send a POST request with body data
$data = [
    'key' => 'value'
];
$response = $paracurl->post($data);
$responseData = json_decode($response, true);

// Send a PUT request with body data
$data = [
    'key' => 'value'
];
$response = $paracurl->put($data);
$responseData = json_decode($response, true);