egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

tcl connection

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
franko
Voice


Joined: 26 Jul 2009
Posts: 4

PostPosted: Sun Jul 26, 2009 1:47 pm    Post subject: tcl connection Reply with quote

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
View user's profile Send private message
tomekk
Master


Joined: 28 Nov 2008
Posts: 255
Location: Oswiecim / Poland

PostPosted: Sun Jul 26, 2009 2:54 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
franko
Voice


Joined: 26 Jul 2009
Posts: 4

PostPosted: Sun Jul 26, 2009 5:36 pm    Post subject: Reply with quote

works fine !!

thanks m8
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
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


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber