Ok i made a php irc bot for my irc and here is the code

<?php
//Get Host, Port, Nick, Room And Nickserv here. 
if ($_POST[nick] == "")
if ($_POST[pass] == "")
if ($_POST[host] == "")
if ($_POST[room] == "")
if ($_POST[port] ==""){
header("Location: wesbot.html");
exit;
}

//Set Nick, Host, Room, Port, and Pass here.
$nick = "$_POST[nick]";
$host = "$_POST[host]";
$room = "$_POST[room]";
$port = "$_POST[port]";
$pass = "$_POST[pass]";

//Set time limit as 0
set_time_limit (0);

//Open a connection to the Irc Server
$socket = fsockopen("$host", "$port") or die ('Could not open a connection to the irc server');

//Set User, Nick and Nickserv Password
fputs($socket, "USER wesircbot http://blankedoutforprivacy.net PHP :phphelpsite\n"); 
fputs($socket, "NICK $nick\n");
fputs($socket,"IDENTIFY $pass\n");


// Set endless loop until exit
while(1)
{
//Continue script here 
while ($data = fgets($socket, 128))
{
echo nl2br($data);
flush();

//Seperate all of the data
$ex = explode(' ', $data);

//Respond to the Ping with a Pong
if($ex[0] == "PING")
{
fputs($socket, "PONG".$ex[1]."\n");
}


// Join a room
fputs($socket,"JOIN $room\n");

// Say something in a channel
$command = str_replace(array(chr(10), chr(13)), '', $ex[3]);

switch($command)
{

//i left out most command because they were unnecessary for my problem


case ':!end':
fputs($socket,"PRIVMSG ".$ex[2]." No Please dont! (O_0)\n");

die('Session ended.');
break;



default:

}
echo '<pre>';
print_r($ex);
echo '</pre>';
}
usleep(100000);
}
?> 

But i get this error

Warning: fsockopen() [function.fsockopen]: unable to connect to wes.dnsdojo.com:6667 (A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. ) in C:\wamp\www\wesbot2.php on line 7
Could not connect to the server

can someone help me???

    Oh some on somebody has to know php and irc i have been racking my brain for the past two months for a solution and looked every where, somebody please Help if you know php and irc.......

      Sounds like it has nothing to do with your PHP code and everything to do with the network that the server is on. As the error message says, the PHP couldn't connect to wes.dns.dojo.com on port 6667, so you should be looking at firewall/internet connectivity issues.

        bradgrafelman wrote:

        Sounds like it has nothing to do with your PHP code and everything to do with the network that the server is on. As the error message says, the PHP couldn't connect to wes.dns.dojo.com on port 6667, so you should be looking at firewall/internet connectivity issues.

        Its not my server because people connect and everything is fine i even checked with unrealirc and anope and they said my server was running fine it. And i have checked my internet with all kinds of tolls and they say its fine.......:glare::queasy: :glare:

          Write a Reply...