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 8720973
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T07:08:46+00:00 2026-06-13T07:08:46+00:00

I’m using a IRC bot written in procedural PHP that was originally created by

  • 0

I’m using a IRC bot written in procedural PHP that was originally created by Phil, and now I’m using it for learning purpose. The bot works, it sets the IRC server and joins the channels that were set, it can also handle simple commands and respond something back into the channel.
But I’m trying to create a command whenever somebody writes “!call wakey wakey it’s time to wake up now” then the bot sends a message inside the channel with a list of usernames and the message that was written after “!call” in a newline after posting the list with names.

For example:

Current users in the channel are:
foo
bar
foobar
barfoo

Person A says: !call does anyone know where I can find my teddy-bear?
Bot responds: foo, bar, foobar, barfoo
Bot responds: does anyone know where I can find my teddy-bear?

What is does, is that is will be triggered if “!call” is at the start of a message. Then it will call a function get_data_call which will take the message from the channel and split the !call and the message and the function only returns the message back or returns false. so far it works, I did get the message stored in a variable.

Now what my problem is:

Now I must send a “NAMES ” command to the IRC server, which then returns a list of usernames that are currently in the channel that the bot is in. But I can’t seem to catch that list, I do see that I get a message back from the server and I’ve tried to use something like that but I’m sure this not the exact way to do it (otherwise it would work):

while (!feof($sock)) 
{
$readCall = fread($sock, 4024);
if ($readCall === true) 
{
while (strpos($readCall, ':irc.rizon.no') !== false) 
{
echo "irc.rizon.no found!";
break;
}
}
else 
{
echo "readCall returns false.";
break;
}
}

This doesn’t work and will always return false.

The full code can be found here: http://pastebin.com/edit.php?i=F2bAdDmS

I hope somebody on this wonderful site can help me with this, I will really appreciate that.

Thank you.
//Xenios

  • 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-06-13T07:08:47+00:00Added an answer on June 13, 2026 at 7:08 am

    strpos() will return a positive integer, or 0, when a match is found. You should try instead using a !== false in your condition, because strpos() can return 0 if a match is found in the first character.

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

Sidebar

Related Questions

That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I'm trying to create an if statement in PHP that prevents a single post
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
I have a jquery bug and I've been looking for hours now, I can't

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.