PHP code example of puzzle9 / zhongwu-printer

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

    

puzzle9 / zhongwu-printer example snippets



$app_id = '******';

$app_secret = '********';

$rpc = new \zhongwu\protocol\RpcClient($app_id, $app_secret, 'http://api.zhongwuyun.com');

$Zprinter = new \zhongwu\Printer($rpc);

$device_id = '1111111';

$device_secret = '11111111';

$printdata = '中午云拥有自主研发的云打印机,提供稳定高效,高可用的云打印方案';

try {

    $Zprinter->set_args($device_id, $device_secret)->cloud_print($printdata);
    
} catch (Exception $e) {

}



$app_id = '******';

$app_secret = '********';

$rpc = new \zhongwu\protocol\RpcClient($app_id, $app_secret, 'http://api.zhongwuyun.com');

$Zprinter = new \zhongwu\Printer($rpc);

$device_id = '1111111';

$device_secret = '11111111';

try {

    $Zprinter->set_args($device_id, $device_secret)->set_sound(1);

} catch (Exception $e) {

}