Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7572689
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T15:59:18+00:00 2026-05-30T15:59:18+00:00

Okay. I know the problem, and I’ll try to describe it, but I cannot

  • 0

Okay. I know the problem, and I’ll try to describe it, but I cannot for the life of me find the answer, to the question.

Okay, so, my bot will connect to the server fine. But this specific server you have to wait for this:

:vervet.foonetic.net 001 Eve :Welcome to the Foonetic IRC Network Eve!~Eve@*-*-*-*.*.*.*.net<br />
:vervet.foonetic.net 002 Eve :Your host is vervet.foonetic.net, running version Unreal3.2.8.1<br />
:vervet.foonetic.net 003 Eve :This server was created Thu Feb 24 2011 at 00:34:28 EST<br />

Pay attention to the first line. “001”.
My bot needs to wait for that line to show up before it can run the JOIN command. It won’t D:
I’ve tried making a while(){} before the while(1){}, I’ve tried a do{}while(), and a simple if().

Here’s my code.

<?php
    set_time_limit(0);

    $conf = array('server' => 'irc.foonetic.net', 'port' => '6667', 'channel' => '#lingubender', 'nick' => 'Eve', 'name' => 'EveBot_1.0', 'description' => 'An IRC bot created by PHP scripter Kinz');
    $replies = array('ver' => 'Eve 1.0', 'part' => 'Good-bye!', 'quit' => 'Shutting down. Talk to you all later!', 'regUsername' => 'example@yahoo.com', 'regPassword' => 'Example');   

    $socket = fsockopen($conf['server'], $conf['port']);
    fputs($socket, "USER ".$conf['nick'].' '.$conf['description'].' '.$conf['nick'].' :'.$conf['name']."\n");
    fputs($socket, "NICK ".$conf['nick']."\n");
    fputs($socket, "JOIN ".$conf['channel']."\n");

    while(1) {
        while($data = fgets($socket, 128)) {
            echo nl2br($data);
            flush();

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



            if ($grip[0] == "PING") {
                fputs($socket, "PONG ".$grip[1]."\n");
            }

            $chan = $grip[2];
            $command = str_replace(array(chr(10), chr(13)), '', $grip[3]);
            strtolower($command);

            if ($command == ":eve" || $command == ":eve,") {
                fputs($socket, "PRIVMSG ".$chan." :Name recognition acknowledged.\n");

                $ex = $grip[4];
                strtolower($ex);

                switch($ex) {
                    case "shutdown":
                        fputs($socket, "QUIT ".$replies['quit']."\n");
                        break;
                    case "version":
                        fputs($socket, "PRIVMSG ".$chan[2]." :".$replies['ver'].' : '.$conf['description']." \n");
                        break;
                }
            } else {
                NULL;
            }
        }
    }
?>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T15:59:19+00:00Added an answer on May 30, 2026 at 3:59 pm

    Well, in this particular example, test if $grip[1] == "001".

    Also, don’t loop for while (1) as it will never end. Loop for while (!feof($socket)), which will terminate the loop the moment the link is dead.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Okay, so the answer to my question might not be the problem but here's
Okay so I know I asked a similar question a while ago, but this
Okay, I know this is a common enough question, but all the solutions I've
Okay I know I asked about this before, and the answer was basically cache
Okay I know this is a really lame question because Starbasic is a really
Okay, I know it is weird but when I put this code between <head
Okay I am newer to python and have been researching this problem but I
Okay, so say i want to find factors of a number a. I know
Okay, this might be a very silly beginner question, but: I've got an ClassA,
Yes, I know that my problem is not the unique, but I have analysed

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.