PHP code example of jenn0pal / airspeedapi-php

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

    

jenn0pal / airspeedapi-php example snippets


use jenn0pal\Api\AirspeedApi;

$api = new AirspeedApi([
    'url' => 'API URL',
    'username' => 'USERNAME',
    'password' => 'PASSWORD',
    'api_key' => 'APIKEY',
    'token' => 'TOKEN'
]);

 $quote_data = [
    "merchantID" => 2,
    "serviceType" => "Door to Door",
    ...
 ];

// Get Quotation
$response = $api->quote($quote_data);
print_r((string) $response->getBody());

// {"ResponseCode":200,"ResponseDetail":"Qoute Generated","deliveryCharge":100.0000,"remarks":"Calculation Success","returnNum":1}


 $pickup_data = [
    "merchantID" => 2,
    "serviceType" => "Door to Door",
    ...
 ];

// Pickup
$response = $api->pickup($pickup_data);
print_r((string) $response->getBody());

// {"ResponseCode":200,"ResponseDetail":"Waybill Updated","id":0,"trackingRefNo":"PXAIR00001" ,"remarks":"Transaction Success","returnNum":2}

composer