<HTML ><HEAD ><TITLE >ircg_pconnect</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK REL="HOME" TITLE="Manual de PHP" HREF="index.html"><LINK REL="UP" TITLE="IRC Gateway Functions" HREF="ref.ircg.html"><LINK REL="PREVIOUS" TITLE="ircg_part" HREF="function.ircg-part.html"><LINK REL="NEXT" TITLE="ircg_register_format_messages" HREF="function.ircg-register-format-messages.html"><META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=ISO-8859-1"></HEAD ><BODY CLASS="refentry" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#840084" ALINK="#0000FF" ><DIV CLASS="NAVHEADER" ><TABLE SUMMARY="Header navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TH COLSPAN="3" ALIGN="center" >Manual de PHP</TH ></TR ><TR ><TD WIDTH="10%" ALIGN="left" VALIGN="bottom" ><A HREF="function.ircg-part.html" ACCESSKEY="P" >Anterior</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" ></TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="function.ircg-register-format-messages.html" ACCESSKEY="N" >Siguiente</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><H1 ><A NAME="function.ircg-pconnect" ></A >ircg_pconnect</H1 ><DIV CLASS="refnamediv" ><A NAME="AEN32970" ></A ><P > (PHP 4 >= 4.0.4)</P >ircg_pconnect -- Connect to an IRC server </DIV ><DIV CLASS="refsect1" ><A NAME="AEN32973" ></A ><H2 >Description</H2 >resource <B CLASS="methodname" >ircg_pconnect</B > ( string username [, string server_ip [, int server_port [, string msg_format [, array ctcp_messages [, array user_settings]]]]])<BR ></BR ><P > <B CLASS="function" >ircg_pconnect()</B > will try to establish a connection to an IRC server and return a connection resource handle for further use. </P ><P > The only mandatory parameter is <TT CLASS="parameter" ><I >username</I ></TT >, this will set your initial nickname on the server. <TT CLASS="parameter" ><I >server_ip</I ></TT > and <TT CLASS="parameter" ><I >server_port</I ></TT > are optional and default to <TT CLASS="literal" >127.0.0.1</TT > and <TT CLASS="literal" >6667</TT >. <DIV CLASS="note" ><BLOCKQUOTE CLASS="note" ><P ><B >Nota: </B > For now parameter <TT CLASS="parameter" ><I >server_ip</I ></TT > will not do any hostname lookups and will only accept IP addresses in numerical form. DNS lookups are expensive and should be done in the context of IRCG. </P ></BLOCKQUOTE ></DIV > </P ><P > You can customize the output of IRC messages and events by selecting a format message set previously created with <A HREF="function.ircg-register-format-messages.html" ><B CLASS="function" >ircg_register_format_messages()</B ></A > by specifying the set's name in <TT CLASS="parameter" ><I >msg_format</I ></TT >. </P ><P > 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 <TT CLASS="parameter" ><I >ctcp_messages</I ></TT >. The keys of the array are the CTCP type and the respective value is the format message. </P ><P > You can define "ident", "password", and "realname" tokens which are sent to the IRC server by setting these in an associative array. Pass that array as <TT CLASS="parameter" ><I >user_settings</I ></TT >. </P ><P > See also: <A HREF="function.ircg-disconnect.html" ><B CLASS="function" >ircg_disconnect()</B ></A >, <A HREF="function.ircg-is-conn-alive.html" ><B CLASS="function" >ircg_is_conn_alive()</B ></A >, <A HREF="function.ircg-register-format-messages.html" ><B CLASS="function" >ircg_register_format_messages()</B ></A >. </P ></DIV ><DIV CLASS="NAVFOOTER" ><HR ALIGN="LEFT" WIDTH="100%"><TABLE SUMMARY="Footer navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" ><A HREF="function.ircg-part.html" ACCESSKEY="P" >Anterior</A ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="index.html" ACCESSKEY="H" >Inicio</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><A HREF="function.ircg-register-format-messages.html" ACCESSKEY="N" >Siguiente</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >ircg_part</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="ref.ircg.html" ACCESSKEY="U" >Subir</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >ircg_register_format_messages</TD ></TR ></TABLE ></DIV ></BODY ></HTML >