在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):xPaw/PHP-Minecraft-Query开源软件地址(OpenSource Url):https://github.com/xPaw/PHP-Minecraft-Query开源编程语言(OpenSource Language):PHP 100.0%开源软件介绍(OpenSource Introduction):PHP Minecraft QueryThis library can be used to query Minecraft servers for some basic information. Differences between Ping and QueryThere are two methods of retrieving information about a Minecraft server. PingPing protocol was added in Minecraft 1.7 and is used to query the server for minimal amount of information (hostname, motd, icon, and a sample of players). This is easier to use and doesn't require extra setup on server side. It uses TCP protocol on the same port as you would connect to your server.
QueryThis method uses GameSpy4 protocol, and requires enabling
Query allows to request a full list of servers' plugins and players, however this method is more prone to breaking, so if you don't need all this information, stick to the ping method as it's more reliable. RCONIt is possible to send console commands to a Minecraft server remotely using the Source RCON protocol. Use PHP Source Query library for your RCON needs. SRV DNS recordThis library automatically tries to resolve SRV records. If you do not wish to do so, pass Example<?php
require __DIR__ . '/src/MinecraftPing.php';
require __DIR__ . '/src/MinecraftPingException.php';
use xPaw\MinecraftPing;
use xPaw\MinecraftPingException;
try
{
$Query = new MinecraftPing( 'localhost', 25565 );
print_r( $Query->Query() );
}
catch( MinecraftPingException $e )
{
echo $e->getMessage();
}
finally
{
if( $Query )
{
$Query->Close();
}
}
?> If you want to get If the server has query enabled ( <?php
require __DIR__ . '/src/MinecraftQuery.php';
require __DIR__ . '/src/MinecraftQueryException.php';
use xPaw\MinecraftQuery;
use xPaw\MinecraftQueryException;
$Query = new MinecraftQuery( );
try
{
$Query->Connect( 'localhost', 25565 );
print_r( $Query->GetInfo( ) );
print_r( $Query->GetPlayers( ) );
}
catch( MinecraftQueryException $e )
{
echo $e->getMessage( );
}
?> For Bedrock servers (MCPE) use License |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论