PHP code example of digital-union / dupco

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

    

digital-union / dupco example snippets




use DigitalUnion\DataClient;
use DigitalUnion\utils\Encrypt;

$clientId = 'cloud-test';
$secretKey = 'aa';
$secretVal = 'yDpDEihpUsF_RyWsCES1H';

$apiId = 'idmap-query-all';
$body = [
    'f' => 'mac,imei',
    'k' => '868862032205613',
    'm' => '0',
];

// ---------- 发送请求 ----------
$client = new DataClient($clientId, $secretKey, $secretVal);
//$client->enableTestMode();

$resp = $client->call($apiId, $body);
var_dump($resp);

// ---------- 加解密 ----------
$encrypt = new Encrypt();

$encode = $encrypt->encode(json_encode($body), $secretVal);
var_dump($encode);

$decode = $encrypt->decode($encode, $secretVal);
var_dump($decode);
shell
php example/index.php