PHP code example of dingq / shanghai-bank

1. Go to this page and download the library: Download dingq/shanghai-bank 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/ */

    

dingq / shanghai-bank example snippets


// 编码为utf-8,会自动转化为gbk

// 配置
$config = [
    'userID'    => 'xxxxxx',
    'userPWD'   => 'xxxxxx',
    'accountNo' => 'xxxxxxxxxxxxxxxxxx',
    'sign_host' => '127.0.0.1:8010',
    'ssl_host'  => '127.0.0.1:7071',
];


$lib = new \Bank\Actions\Main($config);

// 获取银行列表
$lib->getBanks();

// 获取sessionId
$lib->getSessionId();

// 转账
$actionLib->setSerialNo($xxx); // 设置交易序列
$lib->transferCrossBank($xxxxxxxx...);

// 查询转账结果
$actionLib->setSerialNo(null);
$lib->queryTransferResult($xxx);

// 响应体
$lib->response;