Just quickly wrote this up, should work. I'm executing it on the command-line as such: $ php5 rcon.php<?php
// change these however you like
$ip = 'localhost';
$port = 29070;
$pass = 'mypass';
$cmd = 'svsay Hello there!';
$mins = 30;
$packet = str_repeat( chr( 255 ), 4 ) . "rcon $pass $cmd\n";
print( "Sending '$cmd' to $ip:$port every $mins minutes\n" );
if ( $socket = socket_create( AF_INET, SOCK_DGRAM, SOL_UDP ) ) {
while ( 1 ) {
socket_sendto( $socket, $packet, strlen( $packet ), 0, $ip, $port );
sleep( $mins * 60 );
}
}
else {
print( "can't create socket\n" );
}
?>