umm, I cant get it to say anthing
<?
$cfgServer = "localhost";
$cfgPort = 6666;
$cfgTimeOut = 10;
$cfgbotname = "PhpBot";
// open a socket
if(!$cfgTimeOut)
// without timeout
$usenet_handle = fsockopen($cfgServer, $cfgPort);
else
// with timeout
$usenet_handle = fsockopen($cfgServer, $cfgPort, &$errno, &$errstr, $cfgTimeOut);
if(!$usenet_handle) {
echo "*** Connection failed\n";
exit();
} else {
echo "*** Connected to server!\n";
$tmp = fgets($usenet_handle, 1024);
fputs($usenet_handle, ".n".$cfgbotname."\r\n");
$tmp = fgets($usenet_handle, 1024);
//loop to get server data
while($tmp!=".\r\n") {
$tmp = fgets($usenet_handle, 4096);
echo $tmp;
//Split String
list($user, $msg) = split(":", $tmp);
list($msg_command, $command_do) = split(" ", $msg);
//******** test command ***********\\
/*$pos = strpos($msg, "!say hi");
if ($pos <> "") {
fputs($usenet_handle, "hi ".substr($user, 4)."\r\n");
}*/
//******* end test command *******\\
//Try to get bot to say somthing
// example: !say hello
$say_command = strpos($msg_command, "!say");
if ($say_command <> "") {
fputs($usenet_handle, $command_do."\r\n");
echo $msg_command.$command_do;
}
}
}
// close connection
fclose($usenet_handle);
?>
not sure whats wrong, it should respond with anything after !say