PHP code example of pwnraid / bnet

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

    

pwnraid / bnet example snippets


use Boo\BattleNet\Apis\Warcraft\CharacterProfileApi;
use Boo\BattleNet\Regions\EU;
use GuzzleHttp\Client;
use Http\Factory\Guzzle\RequestFactory;

$api = new CharacterProfileApi(
    new RequestFactory(), // Implementation of PSR-17
    new EU(), // API region
    '3797fb20f11da97fbc5fc9335247883c' // API key
);

$request = $api->getCharacterProfile('Draenor', 'Jyggen');
$client = new Client(); // PSR-7 compatible HTTP client
$response = $client->send($request);

var_dump($response);

use Boo\BattleNet\OAuth2\BattleNetProvider;

$provider = new BattleNetProvider([
    'clientId' => '3797fb20f11da97fbc5fc9335247883c',
    'clientSecret' => '7daf46a2c8a780582c6e46e71e5158fd',
    'redirectUri' => 'https://localhost/oauth',
    'region' => new EU(),
]);