最新消息: USBMI致力于为网友们分享Windows、安卓、IOS等主流手机系统相关的资讯以及评测、同时提供相关教程、应用、软件下载等服务。

irc php,PHP

互联网 admin 42浏览 0评论

irc php,PHP

目前,我正在制作一个将消息发送到IRC主频道的IRC.这是我的代码:

$ircServer = "xxxx";

$ircPort = "6667";

$ircChannel = "#bots";

set_time_limit(0);

$msg = $_GET['msg'];

$ircSocket = fsockopen($ircServer, $ircPort, $eN, $eS);

if ($ircSocket)

{

fwrite($ircSocket, "USER Lost rawr.test lol :code\n");

fwrite($ircSocket, "NICK Rawr" . rand() . "\n");

fwrite($ircSocket, "JOIN " . $ircChannel . "\n");

fwrite($ircSocket, "PRIVMSG " . $channel . " :" . $msg = $_GET['msg'] . "\n");

while(1)

{

while($data = fgets($ircSocket, 128))

{

echo nl2br($data);

flush();

// Separate all data

$exData = explode(' ', $data);

// Send PONG back to the server

if($exData[0] == "PING")

{

fwrite($ircSocket, "PONG ".$exData[1]."\n");

}

}

echo $eS . ": " . $eN;

}

}

?>

IRC Bot Tester

Command:

我的问题是BOT没有向该频道发送任何消息,如您所见,我使用post get data作为发送至该频道的消息信息.

这是我收到的日志:

:irc.underworld.no 366 Rawr30517 #bots

:End of /NAMES list.

:irc.underworld.no 411 Rawr30517 :No

recipient given (PRIVMSG) : 0: 0PING

:irc.underworld.no

我不知道是什么原因造成的:

给定的收件人(PRIVMSG):0:0 PING

谢谢任何人能帮助我.我试图将消息简单地发布到机器人,然后机器人将消息传递到主渠道.

解决方法:

更改:

$msg = $_GET['msg'];

...

fwrite($ircSocket, "PRIVMSG " . $channel . " :" . $msg = $_GET['msg'] . "\n");

至:

$msg = $_POST['msg'];

...

fwrite($ircSocket, "PRIVMSG " . $ircChannel . " :" . $msg . "\n");

标签:irc,php

来源: .html

irc php,PHP

目前,我正在制作一个将消息发送到IRC主频道的IRC.这是我的代码:

$ircServer = "xxxx";

$ircPort = "6667";

$ircChannel = "#bots";

set_time_limit(0);

$msg = $_GET['msg'];

$ircSocket = fsockopen($ircServer, $ircPort, $eN, $eS);

if ($ircSocket)

{

fwrite($ircSocket, "USER Lost rawr.test lol :code\n");

fwrite($ircSocket, "NICK Rawr" . rand() . "\n");

fwrite($ircSocket, "JOIN " . $ircChannel . "\n");

fwrite($ircSocket, "PRIVMSG " . $channel . " :" . $msg = $_GET['msg'] . "\n");

while(1)

{

while($data = fgets($ircSocket, 128))

{

echo nl2br($data);

flush();

// Separate all data

$exData = explode(' ', $data);

// Send PONG back to the server

if($exData[0] == "PING")

{

fwrite($ircSocket, "PONG ".$exData[1]."\n");

}

}

echo $eS . ": " . $eN;

}

}

?>

IRC Bot Tester

Command:

我的问题是BOT没有向该频道发送任何消息,如您所见,我使用post get data作为发送至该频道的消息信息.

这是我收到的日志:

:irc.underworld.no 366 Rawr30517 #bots

:End of /NAMES list.

:irc.underworld.no 411 Rawr30517 :No

recipient given (PRIVMSG) : 0: 0PING

:irc.underworld.no

我不知道是什么原因造成的:

给定的收件人(PRIVMSG):0:0 PING

谢谢任何人能帮助我.我试图将消息简单地发布到机器人,然后机器人将消息传递到主渠道.

解决方法:

更改:

$msg = $_GET['msg'];

...

fwrite($ircSocket, "PRIVMSG " . $channel . " :" . $msg = $_GET['msg'] . "\n");

至:

$msg = $_POST['msg'];

...

fwrite($ircSocket, "PRIVMSG " . $ircChannel . " :" . $msg . "\n");

标签:irc,php

来源: .html

发布评论

评论列表 (0)

  1. 暂无评论