Jump to content

Search the Community

Showing results for tags 'data is invalid'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Multi Theft Auto: San Andreas 1.x
    • Support for MTA:SA 1.x
    • User Guides
    • Open Source Contributors
    • Suggestions
    • Ban appeals
  • General MTA
    • News
    • Media
    • Site/Forum/Discord/Mantis/Wiki related
    • MTA Chat
    • Other languages
  • MTA Community
    • Scripting
    • Maps
    • Resources
    • Other Creations & GTA modding
    • Competitive gameplay
    • Servers
  • Other
    • General
    • Multi Theft Auto 0.5r2
    • Third party GTA mods
  • Archive
    • Archived Items
    • Trash

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Gang


Location


Occupation


Interests

Found 1 result

  1. Hello, community! I searched on the forums how to get server information using PHP, but I get the error "Data is invalid" using following code: <?php class CSocketMTA { function CSocketMTA( $IP, $PORT = 22003 ) { if ( $socket = fsockopen( "udp://$IP", $PORT + 123, $errno, $errstr ) ) { stream_set_timeout( $socket, 1, 0 ); fwrite( $socket, "s" ); $data = fread( $socket, 16384 ); fclose( $socket ); if ( substr( $data, 0, 4 ) == "EYE1" ) { $data = substr( $data, 4 ); for ( $i = 0; $data != ""; $i++ ) { if ( substr( $data, 0, 2 ) == chr( 1 ) . "?" ) $data = substr( $data, 2 ); $l = ord( substr( $data, 0, 1 ) ); $buffer[ $i ] = substr( $data, 1, $l - 1 ); $data = substr( $data, $l ); } $this->gameshort = $buffer[ 0 ]; $this->port = $buffer[ 1 ]; $this->name = $buffer[ 2 ]; $this->rules[ 'game' ] = $buffer[ 3 ]; $this->map = $buffer[ 4 ]; $this->rules[ 'version' ] = $buffer[ 5 ]; $this->public = $buffer[ 6 ] != "0"; $this->players = $buffer[ 7 ]; $this->maxplayers = $buffer[ 8 ]; $j = 0; for ( $i = 11; $i < sizeof( $buffer ) - 2; $i += 5 ) { $this->player[ $j ]->name = $buffer[ $i ]; $this->player[ $j ]->score = $buffer[ $i + 3 ]; $this->player[ $j ]->time = 0; $j++; } } else echo "Data is invalid\n"; } else echo "Can not open socket $IP:$PORT - $errstr\n"; } }; ?> I want get the information from any MTA:SA server. Help me, please! Thanks.
×
×
  • Create New...