PHP code example of kylin987 / zzb-ticket-sdk
1. Go to this page and download the library: Download kylin987/zzb-ticket-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/ */
kylin987 / zzb-ticket-sdk example snippets
use ZzbTicketSdk\Config;
use ZzbTicketSdk\ZzbTicketService;
$config = new Config([
'serviceUrl' => 'https://your-host/serverapp',
'reportUrl' => 'https://your-host/serverapp',
'channelCode' => 'your-channel-code',
'certId' => 'your-cert-id',
'appId' => 'your-app-id',
'interfaceKey' => 'your-interface-key',
'certFile' => '/path/to/cert.pem',
'certFilePwd' => 'your-cert-password',
'trustFile' => '/path/to/rootcert.pem',
'version' => '1.0',
]);
$service = new ZzbTicketService($config);
// 查询影院信息
$result = $service->getCinemaInfo('13090401');
if ($result->isSuccess()) {
$cinema = $result->data;
echo $cinema->cinemaName;
}
// 查询排片
$sessions = $service->querySessionInfo('13090401', '2026-01-01', '2026-01-31', 1);
if ($sessions->isSuccess() && $sessions->data) {
foreach ($sessions->data->sessionList as $session) {
echo $session->sessionCode . PHP_EOL;
}
}
// 锁座
$lockResult = $service->lockSeatsInfo('13090401', 'SE0001', 'APP_LOCK_001', [
['seatCode' => '88888888010010011101'],
]);
// 确认订单
if ($lockResult->isSuccess()) {
$lockOrderId = $lockResult->data->lockOrderId;
$orderResult = $service->submitOrder($lockOrderId, '13090401', 'SE0001', [
[
'seatCode' => '88888888010010011101',
'regionCode' => 'R1',
'sectionCode' => 'S1',
'ticketPrice' => 56.00,
'screenServiceFee' => 0.00,
'netServiceFee' => 8.00,
],
]);
}