| View previous topic :: View next topic |
| Author |
Message |
franko Voice
Joined: 26 Jul 2009 Posts: 4
|
Posted: Sun Jul 26, 2009 1:47 pm Post subject: tcl connection |
|
|
Hello..
Hope that anybody can help me here
I coded a PHP script which sends Information to the Eggdrop.
My problem is that i dont receive them correctly..
Here a snippet from my PHP script:
| Code: |
$host="IP";
$port="PORT";
$pass="PW";
$channel="#channel";
$channel2="#channel2";
if($board[cforum] !=="1"){
if($board[uploadsystem]=="2") {
if ($board['invisible']==0) {
if ($fp=@fsockopen($host,$port,$errno,$errstr,30)) {
fputs($fp,$pass."\r\n");
fputs($fp,"PRIVMSG $channel : \0034\002[New]\003\002 \002$name\002 \0034\002[Poster]\003\002 \002$poster @ $user_c\002\r\n ");
fclose($fp);
$fp=@fsockopen($host,$port,$errno,$errstr,30);
fputs($fp,$pass."\r\n");
fputs($fp,"PRIVMSG $channel : \0034\002[Section]\003\002 \002$board[title]\002 \0034\002[Loc]\003\002 \002$country[country_name]\002 \0034\002[time]\003\002 \002$time2\002\r\n ");
fclose($fp);
$fp=@fsockopen($host,$port,$errno,$errstr,30);
fputs($fp,$pass."\r\n");
fputs($fp,"PRIVMSG $channel : \0034\002[URL]\003\002 \002$URL\002 \r\n ");
fclose($fp);
}
}
} |
Anybody an idea how to receive this Information?
lg franko |
|
| Back to top |
|
 |
tomekk Master

Joined: 28 Nov 2008 Posts: 255 Location: Oswiecim / Poland
|
Posted: Sun Jul 26, 2009 2:54 pm Post subject: |
|
|
example:
| Code: | set port 1234
set host 127.0.0.1
###########################################
bind evnt - prerehash prerehash_proc
set s_socket [socket -server socket_proc -myaddr $host $port]
proc prerehash_proc { type } {
global s_socket
close $s_socket
}
proc socket_proc { sock host port } {
fconfigure $sock -buffering line
fileevent $sock readable "action $sock $host $port"
}
proc action { chan host port } {
if {![eof $chan]} {
set data [gets $chan]
if {$data != ""} {
putquick "PRIVMSG #CHANNEL :data from $host:$port -> data = $data"
}
} {
close $chan
}
}
|
its working, but you have to fix your PHP code,
some hints,
1. you don't need to open socket 3 times, you can open it just once, send all data and close it at the end
2. don't send tcl command trough socket, send just data and output it with proper eggdrop script |
|
| Back to top |
|
 |
franko Voice
Joined: 26 Jul 2009 Posts: 4
|
Posted: Sun Jul 26, 2009 5:36 pm Post subject: |
|
|
works fine !!
thanks m8 |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|