I have a problem with space before output with Eggdrop and PHP My eggdrop outputs the text just fine, but with a space before the text. Can someone please help me, to remove the space before!
The PHP code
function ircbot($messages)
{
$bot = array(
'ip' => 'XXX.XXX.XXX.XXX',
'port' => 24587,
'pass' => 'somepassword_',
'pidfile' => '/home/$USER/egg/pid.eggd', //path to the pid. file
'sleep' => 5,
);
if (empty($messages)) die ('Empty message');
if (!file_exists($bot['pidfile'])) die ('Bot not online');
if ($bot['hand'] = fsockopen($bot['ip'], $bot['port'], $errno, $errstr, 45)) {
sleep($bot['sleep']);
if (is_array($messages)) {
foreach ($messages as $message) {
fputs($bot['hand'], $bot['pass'] . ' ' . $message . "
");
sleep($bot['sleep']);
return "Message sent";
}
} else {
fputs($bot['hand'], $bot['pass'] . ' ' . $messages . "
");
sleep($bot['sleep']);
return "Message sent";
}
fclose($bot['hand']);
}
}
And the outout looks like
[04:52:47] <&Egg_D_R> test 5
As you can see there is a space before test 5..
If i replace . ' ' . with , it wont work :(, i already have tried