Я работаю над php-файлом, который подключается к моему игровому серверу и выполняет команду.Пользователи вводят свое имя пользователя в HTML-форму, которая отправляет их, и имя пользователя в php-файл, который подключается к серверу.Порт перенаправлен, и сервер готов к получению информации, но я получаю эту ошибку:
Предупреждение: socket_connect () [function.socket-connect]: невозможно подключиться [110]: истекло время ожидания подключенияв /home/moocraft/public_html/test/vote.php в строке 8 ошибка: не удалось подключиться к хосту
Вот файл HTML:
<html>
<body>
<form action="vote.php" method="post">
Minecraft Username: <input type="text" name="fname" />
<input type="submit" />
</form>
</body>
</html>
Вот файл PHP:
<?php
$HOST = "207.210.254.141"; //the ip of the bukkit server
$password = "examplepassword1";
$player = $_POST["fname"];
//Can't touch this:
$sock = socket_create(AF_INET, SOCK_STREAM, 0)
or die("error: could not create socket\n");
$succ = socket_connect($sock, $HOST, 4445)
or die("error: could not connect to host\n");
//Authentification
socket_write($sock, $command = md5($password)."<Password>", strlen($command) + 1)
or die("error: failed to write to socket\n");
//Begin custom code here.
socket_write($sock, $command = "/Command/ExecuteConsoleCommand:give $player 264 5;", strlen($command) + 1) //Writing text/command we want to send to the server
or die("error: failed to write to socket\n");
socket_write($sock, $command = "$player voted for MOOcraft and earned 5 diamonds. Vote at moocraft.org;", strlen($command) + 1)
or die("error: failed to write to socket\n");
?>
Я не могу понять, почему я продолжаю получать это.Любая помощь с благодарностью.