Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

external api php

<?php
function getServerStatistics($url) {
    $statisticsJson = file_get_contents($url);
    if ($statisticsJson === false) {
       return false;
    }

    $statisticsObj = json_decode($statisticsJson);
    if ($statisticsObj !== null) {
       return false;
    }

    return $statisticsObj;
}

// ...

$stats = getServerStatistics($url);
if ($stats !== false) {
    print $stats->players->online;
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #external #api #php
ADD COMMENT
Topic
Name
4+2 =