Jump to content

[PHP] MTA query script doesn't work


ziomal432

Recommended Posts

I am writing an MTA query script, and I've read this topic: http://forum.game-monitor.com/showthread.php?t=821 but written there doesn't work (probably it works only in PHP 4). I rewrote this:

<?php 
    $ip = '87.238.175.150'; //example server 
    $port = '22003'; 
  
    $socket = fsockopen('udp://' . $ip, $port, $errno, $errstr); 
    socket_set_timeout($socket, 1, 0); 
  
    if($socket) 
    { 
        echo 'Connected.'; 
        fwrite($socket, 's'); 
        $data = fread($socket, 16384); 
        fclose($socket); 
        echo $data;      
    } 
    else 
        echo 'Can\\'t connect.'; 
?> 

it connects to server, but $data variable is empty string. Why? How to make it work?

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...