OK, I will explain the whole thing. I have minecraft server and I use WebToPay service. When someone sends sms he types in "MCLADM (and his name here in my minecraft server). Then that message is send to my website, and is logged there in webtopay.log . The message gets logged like this:
OK 178.16.35.196 [2012-03-15 09:09:59 -0400] v1.5: MIKRO to:"1398", from:"865473201", id:"13525948", sms:"MCLADM sedvis"
when someone else sends message the log will look like:
OK 178.16.35.196 [2012-03-15 09:09:59 -0400] v1.5: MIKRO to:"1398", from:"865473201", id:"13525948", sms:"MCLADM sedvis"
OK 178.16.35.196 [2012-03-16 10:23:43 -0400] v1.5: MIKRO to:"1398", from:"865445896", id:"13526983", sms:"MCLADM petras"
and so on.
So this script has to check if any new messages came and if new sms came, it has to send "/manuadd (username of the sms sender (petras))" to my minecraft server, and somehow it has to be integrated with this...:
<?php
try{
$HOST = "178.16.35.196"; //the ip of the bukkit server
$password = "MCLietuva";
//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/ExecuteConsoleCommandAndReturn-SimpleBroadCast:broadcast lol;", strlen($command) + 1) //Writing text/command we want to send to the server
or die("error: failed to write to socket\n");
sleep(2); // This is example code and here has to be that script i want to make.
//while(($returnedString = socket_read($sock,50000))!= ""){
$returnedString = socket_read($sock,50000,PHP_NORMAL_READ);
print($returnedString)
//}
print("End of script");
socket_close($sock);
}catch(Exception $e){
echo $e->getMessage();
}
?>
and sorry for my english, its not my native language