PHP code example of junoo / nso-auto-capture

1. Go to this page and download the library: Download junoo/nso-auto-capture 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/ */

    

junoo / nso-auto-capture example snippets


protected $except = [
    'nso-auto-capture/callback',
];

use Junoo\NsoAutoCapture\ScreenshotClient;

$client = app(ScreenshotClient::class);

$result = $client->push([
    'id' => 123,
    'username' => 'ninja-account',
    'password' => 'matkhau-goc',
    'server' => 1,
    'charname' => 'TenNhanVat',
]);

$result = app(ScreenshotClient::class)->get();

use Junoo\NsoAutoCapture\ScreenshotClient;

$result = app(ScreenshotClient::class)->callback($request->all());

use App\Listeners\SaveNsoCaptureResult;
use Junoo\NsoAutoCapture\Events\ScreenshotProcessed;

protected $listen = [
    ScreenshotProcessed::class => [
        SaveNsoCaptureResult::class,
    ],
];

namespace App\Listeners;

use Junoo\NsoAutoCapture\Events\ScreenshotProcessed;

class SaveNsoCaptureResult
{
    public function handle(ScreenshotProcessed $event)
    {
        $data = $event->data;

        $accountId = $data['id'] ?? data_get($data, 'data.id');
        $captures = data_get($data, 'data.CAPTURES', []);
        $info = data_get($data, 'data.INFO', []);

        // Lưu ảnh và update GameAccounts tại đây.
    }
}
bash
php artisan vendor:publish --tag=nso-auto-capture-config
text
POST {NSO_AUTO_CAPTURE_API_URL}/push-account
text
GET {NSO_AUTO_CAPTURE_API_URL}/api/get