i have some script which i wrote for someone on another forum, this script is sending simple msgs to the eggdrop, you can fix it for yourself:
here is 'eggsend.php' (file name should be the same like in <form> action and in header()):
Code: Select all
<?php
//eggdrop host port
$egg_port = 1234;
//eggdrop host ip
$egg_ip = '10.0.1.10';
if (isset($_POST['message'])) {
$msg = $_POST['message'];
$sock = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
socket_connect($sock, $egg_ip, $egg_port) or die ('can\'t connect!');
socket_write($sock, $msg);
socket_close($sock);
header("Location: ./eggsend.php");
}
echo "<form action='eggsend.php' method='POST'>";
echo "<input type='text' name='message' cols='20'><br>";
echo "<input type='submit' value='send'>";
echo "</form>";
?>
~
here is script for eggdrop:
Code: Select all
set output_chan "#channel"
# eggdrop port to bind
set port 1234
# eggdrop ip to bind
set host 10.0.1.10
set serverSocket [socket -server main -myaddr $host $port]
proc main { sock host port } {
fconfigure $sock -buffering line
fileevent $sock readable [action $sock $host $port]
}
proc action { chan host port } {
global output_chan
if {![eof $chan]} {
set soc_data [gets $chan]
if {$soc_data != ""} {
putquick "PRIVMSG $output_chan :$host | $port | $soc_data"
}
} {
close $chan
}
}
putlog "sock-server.tcl"
i sent: "lala" through page
bot on chan:
19:54:54 < botty> lala
about your problem, maybe bot is getting timeout cause your php script is holding connection to long?
in those scripts, you are sending information just once, i mean : connect -> send one line -> disconnect, there is no holding of connection
don't know how many data your php script is sending at one time, maybe fix it or something and make it like this "send" script, connect -> announce -> disconnect, and after another connect -> announce -> disconnect
/edit/
just try to load my tcl script to your eggdrop, set up proper ip and port and after change in your php script:
Code: Select all
$ANS = fsockopen('64.85.160.159', 51010);
fputs($ANS, $Announce);
sleep(8);
fclose($ANS);
to:
Code: Select all
$sock = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
socket_connect($sock, '64.85.160.159', 51010) or die ('can\'t connect!');
socket_write($sock, $msg);
socket_close($sock);
and check it, use this php script in proper way
bot should write announce to the chan,
for tests, you can try to use short message: socket_write($sock, "test me");