.josh Posted January 19, 2007 Share Posted January 19, 2007 so you're telling me that this works:[code]//pong at pingsif (strpos($line,"PING :")===0) {fwrite($socket, "PONG :irc.barafranca.com\r\n");}[/code]I just don't see how that's possible.... Quote Link to comment https://forums.phpfreaks.com/topic/34804-php-irc-keeps-leaving/page/2/#findComment-164581 Share on other sites More sharing options...
konnwat Posted January 19, 2007 Author Share Posted January 19, 2007 to be honest, neither do I :D but it does, since i realised it doesn't look right i thought i gotta change it and everytime i did it went mental :s Quote Link to comment https://forums.phpfreaks.com/topic/34804-php-irc-keeps-leaving/page/2/#findComment-164589 Share on other sites More sharing options...
.josh Posted January 19, 2007 Share Posted January 19, 2007 well to be honest, I still think that it is wrong, and the fact that it somehow manages to work, means that there is something bigger wrong with your script... Quote Link to comment https://forums.phpfreaks.com/topic/34804-php-irc-keeps-leaving/page/2/#findComment-164594 Share on other sites More sharing options...
konnwat Posted January 19, 2007 Author Share Posted January 19, 2007 i downloaded it off a website, maybe theres a script before it the counteracts it but i cant see one, its just the while loop. Quote Link to comment https://forums.phpfreaks.com/topic/34804-php-irc-keeps-leaving/page/2/#findComment-164597 Share on other sites More sharing options...
konnwat Posted January 19, 2007 Author Share Posted January 19, 2007 [url=http://info-x.co.uk/fp_8706.asp]http://info-x.co.uk/fp_8706.asp[/url]says that it works :O Quote Link to comment https://forums.phpfreaks.com/topic/34804-php-irc-keeps-leaving/page/2/#findComment-164601 Share on other sites More sharing options...
SharkBait Posted January 19, 2007 Share Posted January 19, 2007 Are you able to output or log the incomming server text?Perhaps it will tell you why you're the bot is timing out?I haven't used php sockets but I have done my own IRC Client with VB.NEt and I can toggle on/off the parsing of the IRC server text. Sometimes it can give you clues as to why you connection drops/timesout. Quote Link to comment https://forums.phpfreaks.com/topic/34804-php-irc-keeps-leaving/page/2/#findComment-164617 Share on other sites More sharing options...
konnwat Posted January 19, 2007 Author Share Posted January 19, 2007 [quote author=SharkBait link=topic=123057.msg508762#msg508762 date=1169235895]Are you able to output or log the incomming server text?Perhaps it will tell you why you're the bot is timing out?I haven't used php sockets but I have done my own IRC Client with VB.NEt and I can toggle on/off the parsing of the IRC server text. Sometimes it can give you clues as to why you connection drops/timesout.[/quote]yes i can, i said this in a previous post. there seems to be no common link of why my bot is leaving. Quote Link to comment https://forums.phpfreaks.com/topic/34804-php-irc-keeps-leaving/page/2/#findComment-164644 Share on other sites More sharing options...
konnwat Posted January 21, 2007 Author Share Posted January 21, 2007 okay i got it,it seems for no reason my bot runs the whole script again and again every now and then :Pthis is my connect code.[code]<?phpset_time_limit(0);//set vars$host = 'irc.barafranca.com';$port = '6667';$nickname = "Bot";$channel = file('../bot/channels.txt');//open data.txt and botlines.txt$cokehandle = fopen('../coke/data.txt', w);$lineshandle = fopen('../botlines.txt', a);fwrite($lineshandle, "\n\n\n");$killmode['#chan'] = 'on';$ks = array();//connect to IRC$socket = fsockopen($host, $port);stream_set_timeout($socket, 60*60*24*365);fwrite($socket, "NICK ".$nickname."\r\n");fwrite($socket, "USER ".$nickname." 8 * :Nick's Bot\r\n");fwrite($socket, "MODE ".$nickname." +B\r\n");while ($line=fgets($socket)) { if (strpos($line, "433")>0) die(); if (strpos($line, "004")>0) { $chancount = count($channel); fwrite($socket, "PRIVMSG nickserv :IDENTIFY Bot hello123\r\n"); for ($i = 0; $i < $chancount; $i++) { fwrite($socket, "JOIN ".$channel[$i]."\r\n"); } break; }}?>[/code]there is a [color=blue]$lineshandle[/color] to log my lines and there are a lot of random "\n\n\n" in the middle of all the lines. this must mean that my whole php script just randomly starts again after a while :s and some times is give me an EOF because it doent run again, it just ends :Phow do i stop this? Quote Link to comment https://forums.phpfreaks.com/topic/34804-php-irc-keeps-leaving/page/2/#findComment-165894 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.