PHP code example of grzesie2k / battleapi

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

    

grzesie2k / battleapi example snippets




use BattleAPI\Game\BF4\Server as BF4Server;
use BattleAPI\Game\Platform;

= new Platform(Platform::PC);

// Create Battlefield server object
$server = new BF4Server($serverId, $platform);

// Send query to Battlelog
$serverPlayers = $server->getPlayers();

// Print results
print_r($serverPlayers);