PHP code example of airmole / bilive-open-api

1. Go to this page and download the library: Download airmole/bilive-open-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/ */

    

airmole / bilive-open-api example snippets




use Airmole\BiliveOpenApi\BiliveService;

$biliveService = new BiliveService('access_key_id', 'access_key_secred');

$start = $biliveService->start('code', 'app_id');
echo "项目开启:\r\n";
print_r($start);

$gameId = $start['data']['game_info']['game_id'];
$heartBeat = $biliveService->heartBeat($gameId);
echo "项目心跳:\r\n";
print_r($heartBeat);

/*
$batchHeartBeat = $biliveService->batchHeartBeat([$gameId]);
echo "项目批量心跳:\r\n";
print_r($batchHeartBeat);
*/

echo "项目关闭:\r\n";
$close = $biliveService->end('app_id', $gameId);
print_r($close);