PHP code example of topphp / topphp-meter-api

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

    

topphp / topphp-meter-api example snippets


//同步
$gateway = new MeterClient();
$res     = $gateway->setAuthCode('37577f8fb62a7b14ba55cc6faec5a142')
    ->setNonce('XOfX547SeCIlhufeeBBwgZIN')
    ->collectorQuery([]);
var_dump($res);

// 异步
$gateway = new EleMeterClient();
$res     = $gateway->setAuthCode('37577f8fb62a7b14ba55cc6faec5a142')
    ->setNonce('XOfX547SeCIlhufeeBBwgZIN')
    ->setNotifyUrl('')
    ->eleSecurityOpenAccount([
        [
            "opr_id"      => $gateway->generateOperateId(),
            "time_out"    => 0,
            "must_online" => true,
            "retry_times" => 1,
            "cid"         => "19020618114",
            "address"     => "000066660942",
            "params"      => [
                "money" => "100",
            ]
        ],
    ], '');
var_dump($res);

TqMeter/AsyncApi/EleMeterClient.php 异步电表接口
TqMeter/AsyncApi/WaterMeterClient.php 异步水表接口
MeterClient.php 同步水电表操作接口