PHP code example of raidkeeper / battlenet-api

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

    

raidkeeper / battlenet-api example snippets


// You will need a Battlnet ClientID and ClientSecret from https://api.battlenet.com
$clientId     = 'foobar';
$clientSecret = 'fizzbuzz';
$region       = 'us';

// The Battlenet client grants access to the API
$client = new Raidkeeper\Api\Battlenet\Client($region, $clientId, $clientSecret);

// Create a new Character object to interact with the 
$character = $client->loadCharacter('charname', 'sargeras');

// Once you have the Character object, you can start reaching out to API endpoints
$data  = $character->getProfile();
$data2 = $character->getEquipment();