Help with using MinecraftPinger API

  • Thread starter Thread starter /u/EmuForward8555
  • Start date Start date
U

/u/EmuForward8555

Guest
Hi,

Sorry for this question, I appreciate its very nooby.

I have been using the MinecraftPinger website (https://minecraftpinger.com) for a while now as it seems to be the only Minecraft Status checker which works for my server - I dont know why! My server shows as offline on others like mcsrvstat.us.

Anyway, I am trying to use this as a script, but I cant get it working.

If it helps at all their documentation is here, but they dont have one for PHP (sorry im not a coder, Im just trying to add a player count to a simple site!!): https://minecraftpinger.com/api

Here is the code im using, could anyone please kindly help if possible:

<?php function pingMinecraftServer($host, $port) { $url = "http://minecraftpinger.com/api/v1/" . $host . ":" . $port; $ch = curl_init(); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_TIMEOUT, "10"); $response = curl_exec($ch); curl_close($ch); return $response; } $result = pingMinecraftServer("hypixel.net", 25565); print_r($result); // Output here is false but I dont know why!
submitted by /u/EmuForward8555
[link] [comments]

Continue reading...
 
Back
Top