Jump to content

[PHP] MTA query script doesn't work


ziomal432

Recommended Posts

Posted

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?

Posted

Looks like it's just outdated (strange, query string didn't changed, probably response handling is different).

(probably it works only in PHP 4).

And PHP 4 doesn't support OOP, so it actually work only for PHP5 :P

Solution:

http://callofdutystats.net/

Multi theft auto tools - replace cars and peds, move your map or compile your Lua files online!

programista php rzeszów

Need free webhosting for your small site? PM me. Need help with portforwarding? PM me. Do not PM me asking for help with scripting.

Having problems with port forwarding? Send me pm, I can do whole thing for you using TeamViewer (already helped about 20 people, no worries)!

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...