This repository is a PHP SDK to call Dramabox APIs (hosted under sapi.dramaboxdb.com), plus a small test.php example that calls NewList and returns JSON.
For PHP developers who want a quick integration and will customize request headers/signatures to match their own device/token.
.
├── DramaboxApp.php # Signature helper using your private key
├── DramaboxApi.php # API wrappers: NewList, searchSuggest, ...
├── test.php # Tiny example endpoint calling NewList and echoing JSON
└── private_key.pem # (required) private key used by openssl_sign
Important: put private_key.pem next to DramaboxApp.php. Make sure the key matches what the server expects.
- PHP 8.1+ (8.2+ recommended)
opensslextension enabled- Outbound internet access to
https://sapi.dramaboxdb.com/
Check extensions:
php -m | grep openssl-
Extract the files into a working folder (e.g.,
/var/www/dramabox/). -
Prepare
private_key.pem- Place it in the same folder as
DramaboxApp.php. - Suggested permissions
0600and owned by your PHP/web user.
- Place it in the same folder as
-
Configure constants in
DramaboxApi.phpOpen and set real values:const DRBX_BEARER = "Bearer token"; // e.g. "Bearer eyJhbGciOi..." const DRBX_DEVICE = "DEVICE"; // device id / UUID const DRBX_ANDROID = "ANDROID"; // android id const DRBX_USER_ID = "XXXXXXXX"; // user id
You can tweak/add headers in
base_headers()and useDramaboxApp::dramabox()to produce thesnsignature header per endpoint.
Run a local PHP server:
php -S 127.0.0.1:8080 -t .Call the sample endpoint:
curl "http://127.0.0.1:8080/test.php?pageNo=1&pageSize=15&lang=en"Sample result:
{
"success": true,
"data": {
"list": [ { "bookId": 123, "bookName": "..." } ],
"isMore": true,
"total": 15,
"raw": { "...": "upstream payload" }
}
}<?php
require_once __DIR__ . '/DramaboxApi.php';
$pageNo = 1; $pageSize = 20; $lang = 'en';
$typeList = DEFAULT_TYPE_LIST; // or your own type
$result = api_NewList($pageNo, $pageSize, $typeList, $lang);
print_r($result);<?php
require_once __DIR__ . '/DramaboxApi.php';
$suggest = api_searchSuggest('love', 'en');
foreach ($suggest as $row) {
echo $row['name'] ?? $row['keyword'], "
";
}<?php
require_once __DIR__ . '/DramaboxApi.php';
$kw = 'romance';
$data = api_searchByKeyword($kw, pageNo:1, pageSize:20, lang:'en');
var_dump($data);<?php
require_once __DIR__ . '/DramaboxApi.php';
$bookId = 123456;
$chapters = api_listChapters($bookId, 'en');
print_r($chapters);<?php
require_once __DIR__ . '/DramaboxApi.php';
$bookId = 123456;
$chapterIds = [111,112,113];
$payload = api_batchDownload($bookId, $chapterIds, 'en');
// Inspect links/metadata returned by the upstream APIThe actual function names provided by
DramaboxApi.phpmay include:api_latestList,api_NewList,api_searchSuggest,api_searchByKeyword,api_listChapters,api_batchDownload.
DramaboxApi.phpbuilds standard headers inbase_headers()such asAuthorization,device,platform,userId,language, etc.- Some endpoints require
sn(SHA256 with RSA over a specific string/body). UseDramaboxApp::dramabox($string). - If the server expects a specific canonicalization (key order, JSON string, pre-hash), mirror that in your signer.
Example (conceptual):
$body = [ 'keyword' => $keyword ];
$headers = base_headers();
$headers['sn'] = create_signature($body); // calls DramaboxApp::dramabox internally
$headers['language'] = $lang;
$headers['current-language'] = $lang;MIT for the sample code unless you specify otherwise in your project.
- Signature/header structure inspired by reverse-engineering Dramabox app traffic for private integration/testing. Use responsibly and respect the service terms.