Notifications
Clear all

Battlemetrics API Code Snippets

 

SanjaDev
(@sanyaa87)
New Member Customer
Joined: 2 years ago
Posts: 1
Topic starter  

Output of the server card as an image not as text php code

for webview

<?php
$api = 'https://api.battlemetrics.com/servers/';
$server = '12481084';
$api_full = $api . $server;
$json = file_get_contents("$api_full");
$response = json_decode($json, true);
/*------MAP-----*/

$map = $response['data']['attributes']['details']['map'];
echo '<img src="' . $map . '.png"/>';

?>

open the mods arraylist and let everything output from the array

for Querystring

<?php
$api = 'https://api.battlemetrics.com/servers/';
$server = '8860909'; 
$api_full = $api . $server;
$json = file_get_contents ("$api_full");
$response = json_decode($json, true);


$modNames = $response['data']['attributes']['details']['modNames'];

var_dump($modNames);

for($cnt=0; $cnt<count($modNames); $cnt++) {
echo $modNames[$cnt];
}

?>

Quote
Topic Tags
php
Share: