How do I connect to IRC with Php?

I am trying to create a bot for a friends stream. I want to host this on my hosting account but only have access to PHP or Javascript. I am more comfortable/familiar with PHP than Js so was hoping to do it in PHP. The problem I am having is 1) I have never done anything with IRC, and 2) I have never built a bot.

Can someone please help me get connected to Twitch IRC?

I created a gitHub Repo so I do not have to copy/paste everything in which can be found Here

Not knowing any better solution I figured I could create a webpage that had a button that connected the bot. I know that I will need to create a login system, but for now this is where I am at.

Edit: I guess I should mention what is happening. There seems to be something wrong within my Config.php file because when I comment that out I do not get any errors. However when it is not commented out I am getting this:

TypeError: undefined is not an object (evaluating ‘$.a.hashList.theList.length’)
(anonymous function)

which you can see for yourself Here

My two cents, although this is not general programming forum:

  • The error message is from JavaScript
  • Use absolute paths when including, e.g. require_once(__DIR__.'/../config.php');.
  • you don’t need to put the closing tag (?>) at the end of PHP files. So omit these to reduce future errors regarding “headers already sent”
  • var $ex array(); is missing an equals?
  • send_data() is not implemented yet, I guess?

I don’t think that hosting your bot on a web hosting server is going to work. Most web servers terminate scripts that are running for a longer time. Normally, I’d suggest to invest a few dollars per month and get an VPS. But those are not managed, which means you’d have to do everything yourself (packet installation and configuration, security stuff, …).

id love to get a VPS for this project, but I am not able to afford it at the moment. I have been told by enough people that Php is not the way to go. I will just suck it up and just work with javascript. Thanks for your reply none the less.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.