IRC Gateway
PHP Manual


(PHP 4 >= 4.0.4, PHP 5 <= 5.0.5)

ircg_pconnect — Connect to an IRC server


resource ircg_pconnect ( string $username [, string $server_ip [, int $server_port [, string $msg_format [, array $ctcp_messages [, array $user_settings [, bool $bailout_on_trivial ]]]]]] )

ircg_pconnect() will try to establish a connection to an IRC server.



The initial nickname on the server.


The IRC server address.

server_ip must be an IP address in numerical form. DNS lookups are expensive and should be done in the context of IRCG. Default to


The server port number. Default to 6667.


You can customize the output of IRC messages and events by selecting a format message set previously created with ircg_register_format_messages() by specifying the set's name in msg_format .


If you want to handle CTCP messages such as ACTION (/me), you need to define a mapping from CTCP type (e.g. ACTION) to a custom format string. Do this by passing an associative array as ctcp_messages . The keys of the array are the CTCP type and the respective value is the format message.


You can define "ident", "password", and "realname" tokens which are sent to the IRC server by setting these in this associative array.


Return Values

Returns a connection resource handle for further use, or FALSE on error.

See Also

IRC Gateway
PHP Manual