PHP Player Counter

Status
This thread has been locked.

TheCrystalStar

Banned
Feedback score
2
Posts
213
Reactions
65
Resources
0
hey I'm a web developer and I've been having loads of trouble adding php queries. I've tried xpaws version I just can't get it to work. Does any one have a really simple script that gets the amount of players from a server?

So I can use it in like a paragraph tag <?php echo $playerCount ?>

I don't know I just need to get player count. Please help
 
PebbleHost
High performance, consistent uptime and fast support. Minecraft hosting that just works.

polarline

Premium
Feedback score
46
Posts
835
Reactions
157
Resources
20
hey I'm a web developer and I've been having loads of trouble adding php queries. I've tried xpaws version I just can't get it to work. Does any one have a really simple script that gets the amount of players from a server?

So I can use it in like a paragraph tag <?php echo $playerCount ?>

I don't know I just need to get player count. Please help
The easiest is API, but you are depending on the API server being up. PM me to fore more info.
 

TheBanapple

Premium
Feedback score
0
Posts
41
Reactions
38
Resources
0
Give me a minute, I'll get you the code from my pages.[DOUBLEPOST=1460316618][/DOUBLEPOST]In this example I have used http://mcapi.ca but any api should work.
PHP:
$data = json_decode( file_get_contents( "http://mcapi.ca/query/us.mineplex.net/players" ), true );
if ($data['status'] == true) {
    $online = "Server currently has ".$data['players']['online']." online players!";
} else {
    $online = "Server currently offline."
}

echo $online;

Enjoy!
 
Last edited:

TheCrystalStar

Banned
Feedback score
2
Posts
213
Reactions
65
Resources
0
Give me a minute, I'll get you the code from my pages.[DOUBLEPOST=1460316618][/DOUBLEPOST]In this example I have used http://mcapi.ca but any api should work.
PHP:
$data = json_decode( file_get_contents( "http://mcapi.ca/query/us.mineplex.net/players" ), true );
if ($data['status'] == true) {
    $online = "Server currently has ".$data['players']['online']." online players!";
} else {
    $online = "Server currently offline."
}

echo $online;

Enjoy!

YO THX dude it worked
 
Banned forever. Reason: Scamming (https://builtbybit.com/threads/thecrystalstar-scam-report.276555/)

TheBanapple

Premium
Feedback score
0
Posts
41
Reactions
38
Resources
0
Status
This thread has been locked.
Top