PHP code example of mywhistlebox / mwb-sdk

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

    

mywhistlebox / mwb-sdk example snippets



wb\MwbClient;

$client = new MwbClient("<apikey>");

Response {
    status: "ok",
    key: object | value,
    ....
}

Response {
    status: "error",
    code: <error code string>,
    message: <error message string>
}


wb\MwbClient;

$client = new MwbClient(APIKEY);
$response = $client->ping();
if ($response['status'] == 'ok') {
    echo "RESULT: Server has been pinged successfully<br>\n";
} else {
    if ($response['status'] == 'access') {
        echo "ERROR: Access denied.  Please check your ApiKey<br>\n";
    } else {
        echo "ERROR:". $response['message'];
    }
}


wb\MwbClient;

$client = new MwbClient(APIKEY);
$response =  $client->listBoxes();
if ($response['status'] == 'ok') {
   print_r($response);
} else {
    if ($response['status'] == 'access') {
        echo "ERROR: Access denied.  Please check your ApiKey<br>\n";
    } else {
        echo "ERROR:". $response['message'];
    }
}


wb\MwbClient;

$client = new MwbClient(APIKEY);
$response =  $client->requestUpload(<box_id>, <email_address>);
if ($response['status'] == 'ok') {
   print_r($response);
} else {
    if ($response['status'] == 'access') {
        echo "ERROR: Access denied.  Please check your ApiKey<br>\n";
    } else {
        echo "ERROR:". $response['message'];
    }
}
bash
curl -sS https://getcomposer.org/installer | php