IRC bot class - help needed on getting the hostname

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Stijn Herreman
Forum Newbie
Posts: 2
Joined: Sat Aug 26, 2006 7:09 pm

IRC bot class - help needed on getting the hostname

Post by Stijn Herreman »

I'm writing an IRC bot class in PHP, and need some help to get a specific piece of information.

For the USER command, I need the hostname. mIRC gets this by itself, but I need to get it with PHP.
An example of a possible hostname is d54C38C01.access.telenet.be

Any help would be apreciated.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

I believe there's an IRC class on phpclasses.org.
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post by timvw »

Since your establishing a connection from the webserver you can (should) use the webserver hostname... $_SERVER['NAME'] or $_SERVER['ADDR'] will do just fine...
Stijn Herreman
Forum Newbie
Posts: 2
Joined: Sat Aug 26, 2006 7:09 pm

Post by Stijn Herreman »

feyd wrote:I believe there's an IRC class on phpclasses.org.
I also found one on PEAR, but wanted to write my own :)

@timvw: I'll try your solution
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

I wasn't suggesting using them, but looking at them for examples of what they are using.
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post by timvw »

Stijn Herreman wrote: @timvw: I'll try your solution
It all depends on the irc network you're trying to connect with.. A couple of them require that you have an identd running.. (kreynet doesn't require this.. but without and identd it just takes a lot longer to get connected...)
User avatar
daedalus__
DevNet Resident
Posts: 1925
Joined: Thu Feb 09, 2006 4:52 pm

Post by daedalus__ »

You may want to head into some php channels on IRC and ask around, I've seen alot of great stuff in them including one bot that would process php code and output the results to the channel.

a-mazing.
Post Reply