cortesi Thu Jan 24 10:36:13 2002 EDT
Modified files:
/phpdoc/it/functions network.xml
Log:
committing not yet finished translation
translator has given up the work
I will take care of the remaining translation
next week due to DocBook changes planned for the WE
Index: phpdoc/it/functions/network.xml
diff -u /dev/null phpdoc/it/functions/network.xml:1.10
--- /dev/null Thu Jan 24 10:36:13 2002
+++ phpdoc/it/functions/network.xml Thu Jan 24 10:36:12 2002
@@ -0,0 +1,1033 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!-- EN-Revision: 1.44 Maintainer: cortesi Status: ready -->
+<!-- CREDITS: valente -->
+ <reference id="ref.network">
+ <title>Funzioni di rete</title>
+ <titleabbrev>Rete</titleabbrev>
+
+ <refentry id="function.checkdnsrr">
+ <refnamediv>
+ <refname>checkdnsrr</refname>
+ <refpurpose>
+ Controlla i record DNS relativi ad un host Internet o
+ indirizzo IP
+ </refpurpose>
+ </refnamediv>
+ <refsect1>
+ <title>Descrizione</title>
+ <funcsynopsis>
+ <funcprototype>
+ <funcdef>int <function>checkdnsrr</function></funcdef>
+ <paramdef>string <parameter>host</parameter></paramdef>
+ <paramdef>string
+ <parameter><optional>type</optional></parameter>
+ </paramdef>
+ </funcprototype>
+ </funcsynopsis>
+ <simpara>
+ Cerca i record DNS del tipo <parameter>type</parameter>
+ corrispondenti a <parameter>host</parameter>. Restituisce vero se
+ dei records sono trovati; falso se nessun record viene trovato
+ o in caso di errore.
+ </simpara>
+ <simpara>
+ <parameter>type</parameter> pu� essere uno dei seguenti: A, MX,
+ NS, SOA, PTR, CNAME, oppure ANY. Il default � MX.
+ </simpara>
+ <simpara>
+ <parameter>Host</parameter> pu� essere sia l'indirizzo IP in
+ notazione decimale o il nome dell'host.
+ </simpara>
+ ¬e.no-windows;
+ <simpara>
+ Vedere anche <function>getmxrr</function>,
+ <function>gethostbyaddr</function>,
+ <function>gethostbyname</function>,
+ <function>gethostbynamel</function> e la man page
+ named(8).
+ </simpara>
+ </refsect1>
+ </refentry>
+
+ <refentry id="function.closelog">
+ <refnamediv>
+ <refname>closelog</refname>
+ <refpurpose>Chiude la connessione al logger di sistema</refpurpose>
+ </refnamediv>
+ <refsect1>
+ <title>Descrizione</title>
+ <funcsynopsis>
+ <funcprototype>
+ <funcdef>int <function>closelog</function></funcdef>
+ <void/>
+ </funcprototype>
+ </funcsynopsis>
+ <para>
+ <function>closelog</function> chiude il descrittore usato
+ per scrivere al logger di sistema. L'uso di
+ <function>closelog</function> � facoltativo.
+ </para>
+ <para>
+ Vedere anche <function>define_syslog_variables</function>,
+ <function>syslog</function> e
+ <function>openlog</function>.
+ </para>
+ </refsect1>
+ </refentry>
+
+ <refentry id="function.debugger-off">
+ <refnamediv>
+ <refname>debugger_off</refname>
+ <refpurpose>Disattiva il debugger interno PHP</refpurpose>
+ </refnamediv>
+ <refsect1>
+ <title>Descrizione</title>
+ <funcsynopsis>
+ <funcprototype>
+ <funcdef>int <function>debugger_off</function></funcdef>
+ <void/>
+ </funcprototype>
+ </funcsynopsis>
+ <para>
+ Disattiva il debugger interno PHP. Il debugger � ancora in fase di
+ sviluppo.
+ </para>
+ </refsect1>
+ </refentry>
+
+ <refentry id="function.debugger-on">
+ <refnamediv>
+ <refname>debugger_on</refname>
+ <refpurpose>Attiva il debugger interno PHP</refpurpose>
+ </refnamediv>
+ <refsect1>
+ <title>Descrizione</title>
+ <funcsynopsis>
+ <funcprototype>
+ <funcdef>int <function>debugger_on</function></funcdef>
+ <paramdef>string <parameter>address</parameter></paramdef>
+ </funcprototype>
+ </funcsynopsis>
+ <para>
+ Attiva il debugger interno PHP, connecting it to
+ <parameter>address</parameter>. The debugger is still under
+ development.
+ </para>
+ </refsect1>
+ </refentry>
+
+ <refentry id="function.define-syslog-variables">
+ <refnamediv>
+ <refname>define_syslog_variables</refname>
+ <refpurpose>Initializes all syslog related constants</refpurpose>
+ </refnamediv>
+ <refsect1>
+ <title>Descrizione</title>
+ <funcsynopsis>
+ <funcprototype>
+ <funcdef>void <function>define_syslog_variables</function></funcdef>
+ <void/>
+ </funcprototype>
+ </funcsynopsis>
+ <para>
+ Initializes all constants used in the syslog functions.
+ </para>
+ <para>
+ Vedere anche <function>openlog</function>,
+ <function>syslog</function> and
+ <function>closelog</function>.
+ </para>
+ </refsect1>
+ </refentry>
+
+
+ <refentry id="function.fsockopen">
+ <refnamediv>
+ <refname>fsockopen</refname>
+ <refpurpose>
+ Open Internet or Unix domain socket connection
+ </refpurpose>
+ </refnamediv>
+ <refsect1>
+ <title>Descrizione</title>
+ <funcsynopsis>
+ <funcprototype>
+ <funcdef>int <function>fsockopen</function></funcdef>
+ <paramdef>
+ string <parameter><optional>udp://</optional>hostname</parameter>
+ </paramdef>
+ <paramdef>int <parameter>port</parameter></paramdef>
+ <paramdef>int
+ <parameter><optional>errno</optional></parameter>
+ </paramdef>
+ <paramdef>string
+ <parameter><optional>errstr</optional></parameter>
+ </paramdef>
+ <paramdef>float
+ <parameter><optional>timeout</optional></parameter>
+ </paramdef>
+ </funcprototype>
+ </funcsynopsis>
+ <para>
+ Initiates a stream connection in the Internet (AF_INET, using TCP
+ or UDP) or Unix (AF_UNIX) domain. For the Internet domain, it
+ will open a TCP socket connection to
+ <parameter>hostname</parameter> on port
+ <parameter>port</parameter>. <parameter>hostname</parameter> may
+ in this case be either a fully qualified domain name or an IP
+ address. For UDP connections, you need to explicitly specify the
+ protocol: <parameter>udp://hostname</parameter>. For the Unix
+ domain, <parameter>hostname</parameter> will be used as the path
+ to the socket, <parameter>port</parameter> must be set to 0 in
+ this case. The optional <parameter>timeout</parameter> can be
+ used to set a timeout in seconds for the connect system call.
+ </para>
+ <para>
+ <function>fsockopen</function> returns a file pointer which may
+ be used together with the other file functions (such as
+ <function>fgets</function>, <function>fgetss</function>,
+ <function>fputs</function>, <function>fclose</function>, and
+ <function>feof</function>).
+ </para>
+ <para>
+ If the call fails, it will return &false; and if the optional
+ <parameter>errno</parameter> and <parameter>errstr</parameter>
+ arguments are present they will be set to indicate the actual
+ system level error that occurred on the system-level
+ <literal>connect()</literal> call. If the returned errno is 0 and
+ the function returned &false;, it is an indication that the error
+ occurred before the <literal>connect()</literal> call. This is
+ most likely due to a problem initializing the socket. Note that
+ the <parameter>errno</parameter> and
+ <parameter>errstr</parameter> arguments must be passed by
+ reference.
+ </para>
+ <para>
+ Depending on the environment, the Unix domain or the optional
+ connect timeout may not be available.
+ </para>
+ <para>
+ The socket will by default be opened in blocking mode. You can
+ switch it to non-blocking mode by using
+ <function>socket_set_blocking</function>.
+ <example>
+ <title><function>fsockopen</function> Example</title>
+ <programlisting role="php">
+$fp = fsockopen ("www.php.net", 80, $errno, $errstr, 30);
+if (!$fp) {
+ echo "$errstr ($errno)<br>\n";
+} else {
+ fputs ($fp, "GET / HTTP/1.0\r\n\r\n");
+ while (!feof($fp)) {
+ echo fgets ($fp,128);
+ }
+ fclose ($fp);
+}
+ </programlisting>
+ </example>
+ The example below shows how to retrieve the day and time
+ from the UDP service "daytime" (port 13) in your own machine.
+ <example>
+ <title>Using UDP connection</title>
+ <programlisting role="php">
+<?php
+$fp = fsockopen("udp://127.0.0.1", 13, $errno, $errstr);
+if (!$fp) {
+ echo "ERROR: $errno - $errstr<br>\n";
+} else {
+ fwrite($fp,"\n");
+ echo fread($fp, 26);
+ fclose($fp);
+}
+?>
+ </programlisting>
+ </example>
+ <note>
+ <para>The timeout parameter was introduced in PHP 3.0.9 and
+ UDP support was added in PHP 4.
+ </para>
+ </note>
+ Vedere anche: <function>pfsockopen</function>,
+ <function>socket_set_blocking</function>,
+ <function>socket_set_timeout</function>, <function>fgets</function>,
+ <function>fgetss</function>, <function>fputs</function>,
+ <function>fclose</function>, and <function>feof</function>).
+ </para>
+ </refsect1>
+ </refentry>
+
+ <refentry id="function.gethostbyaddr">
+ <refnamediv>
+ <refname>gethostbyaddr</refname>
+ <refpurpose>
+ Get the Internet host name corresponding to a given IP address
+ </refpurpose>
+ </refnamediv>
+ <refsect1>
+ <title>Descrizione</title>
+ <funcsynopsis>
+ <funcprototype>
+ <funcdef>string <function>gethostbyaddr</function></funcdef>
+ <paramdef>string <parameter>ip_address</parameter></paramdef>
+ </funcprototype>
+ </funcsynopsis>
+ <para>
+ Returns the host name of the Internet host specified by
+ <parameter>ip_address</parameter>. If an error occurs, returns
+ <parameter>ip_address</parameter>.
+ </para>
+ <para>
+ Vedere anche <function>gethostbyname</function>.
+ </para>
+ </refsect1>
+ </refentry>
+
+ <refentry id="function.gethostbyname">
+ <refnamediv>
+ <refname>gethostbyname</refname>
+ <refpurpose>
+ Get the IP address corresponding to a given Internet host name
+ </refpurpose>
+ </refnamediv>
+ <refsect1>
+ <title>Descrizione</title>
+ <funcsynopsis>
+ <funcprototype>
+ <funcdef>string <function>gethostbyname</function></funcdef>
+ <paramdef>string <parameter>hostname</parameter></paramdef>
+ </funcprototype>
+ </funcsynopsis>
+ <para>
+ Returns the IP address of the Internet host specified by
+ <parameter>hostname</parameter>.
+ </para>
+ <para>
+ Vedere anche <function>gethostbyaddr</function>.
+ </para>
+ </refsect1>
+ </refentry>
+
+ <refentry id="function.gethostbynamel">
+ <refnamediv>
+ <refname>gethostbynamel</refname>
+ <refpurpose>
+ Get a list of IP addresses corresponding to a given Internet host
+ name
+ </refpurpose>
+ </refnamediv>
+ <refsect1>
+ <title>Descrizione</title>
+ <funcsynopsis>
+ <funcprototype>
+ <funcdef>array <function>gethostbynamel</function></funcdef>
+ <paramdef>string <parameter>hostname</parameter></paramdef>
+ </funcprototype>
+ </funcsynopsis>
+ <para>
+ Returns a list of IP addresses to which the Internet host
+ specified by <parameter>hostname</parameter> resolves.
+ </para>
+ <para>
+ Vedere anche <function>gethostbyname</function>,
+ <function>gethostbyaddr</function>,
+ <function>checkdnsrr</function>, <function>getmxrr</function>,
+ and the <literal>named(8)</literal> manual page.
+ </para>
+ </refsect1>
+ </refentry>
+
+ <refentry id="function.getmxrr">
+ <refnamediv>
+ <refname>getmxrr</refname>
+ <refpurpose>
+ Get MX records corresponding to a given Internet host name
+ </refpurpose>
+ </refnamediv>
+ <refsect1>
+ <title>Descrizione</title>
+ <funcsynopsis>
+ <funcprototype>
+ <funcdef>int <function>getmxrr</function></funcdef>
+ <paramdef>string <parameter>hostname</parameter></paramdef>
+ <paramdef>array <parameter>mxhosts</parameter></paramdef>
+ <paramdef>array
+ <parameter><optional>weight</optional></parameter>
+ </paramdef>
+ </funcprototype>
+ </funcsynopsis>
+ <simpara>
+ Searches DNS for MX records corresponding to
+ <parameter>hostname</parameter>. Returns &true; if any records are
+ found; returns &false; if no records were found or if an error
+ occurred.
+ </simpara>
+ <simpara>
+ A list of the MX records found is placed into the array
+ <parameter>mxhosts</parameter>. If the
+ <parameter>weight</parameter> array is given, it will be filled
+ with the weight information gathered.
+ </simpara>
+ <simpara>
+ Vedere anche <function>checkdnsrr</function>,
+ <function>gethostbyname</function>,
+ <function>gethostbynamel</function>,
+ <function>gethostbyaddr</function>, and the
+ <literal>named(8)</literal> manual page.
+ </simpara>
+ </refsect1>
+ </refentry>
+
+ <refentry id="function.getprotobyname">
+ <refnamediv>
+ <refname>getprotobyname</refname>
+ <refpurpose>
+ Get protocol number associated with protocol name
+ </refpurpose>
+ </refnamediv>
+ <refsect1>
+ <title>Descrizione</title>
+ <funcsynopsis>
+ <funcprototype>
+ <funcdef>int <function>getprotobyname</function></funcdef>
+ <paramdef>string <parameter>name</parameter></paramdef>
+ </funcprototype>
+ </funcsynopsis>
+ <para>
+ <function>getprotobyname</function> returns the protocol number
+ associated with the protocol <parameter>name</parameter> as per
+ /etc/protocols.
+ </para>
+ <para>
+ Vedere anche: <function>getprotobynumber</function>.
+ </para>
+ </refsect1>
+ </refentry>
+
+ <refentry id="function.getprotobynumber">
+ <refnamediv>
+ <refname>getprotobynumber</refname>
+ <refpurpose>
+ Get protocol name associated with protocol number
+ </refpurpose>
+ </refnamediv>
+ <refsect1>
+ <title>Descrizione</title>
+ <funcsynopsis>
+ <funcprototype>
+ <funcdef>string <function>getprotobynumber</function></funcdef>
+ <paramdef>int <parameter>number</parameter></paramdef>
+ </funcprototype>
+ </funcsynopsis>
+ <para>
+ <function>getprotobynumber</function> returns the protocol name
+ associated with protocol <parameter>number</parameter> as per
+ /etc/protocols.
+ </para>
+ <para>
+ Vedere anche: <function>getprotobyname</function>.
+ </para>
+ </refsect1>
+ </refentry>
+
+ <refentry id="function.getservbyname">
+ <refnamediv>
+ <refname>getservbyname</refname>
+ <refpurpose>
+ Get port number associated with an Internet service and protocol
+ </refpurpose>
+ </refnamediv>
+ <refsect1>
+ <title>Descrizione</title>
+ <funcsynopsis>
+ <funcprototype>
+ <funcdef>int <function>getservbyname</function></funcdef>
+ <paramdef>string <parameter>service</parameter></paramdef>
+ <paramdef>string <parameter>protocol</parameter></paramdef>
+ </funcprototype>
+ </funcsynopsis>
+ <para>
+ <function>getservbyname</function> returns the Internet port
+ which corresponds to <parameter>service</parameter> for the
+ specified <parameter>protocol</parameter> as per
+ <filename>/etc/services</filename>.
+ <parameter>protocol</parameter> is either <literal>TCP</literal>
+ or <literal>UDP</literal>.
+ </para>
+ <para>
+ Vedere anche: <function>getservbyport</function>.
+ </para>
+ </refsect1>
+ </refentry>
+
+ <refentry id="function.getservbyport">
+ <refnamediv>
+ <refname>getservbyport</refname>
+ <refpurpose>
+ Get Internet service which corresponds to port and protocol
+ </refpurpose>
+ </refnamediv>
+ <refsect1>
+ <title>Descrizione</title>
+ <funcsynopsis>
+ <funcprototype>
+ <funcdef>string <function>getservbyport</function></funcdef>
+ <paramdef>int <parameter>port</parameter></paramdef>
+ <paramdef>string <parameter>protocol</parameter></paramdef>
+ </funcprototype>
+ </funcsynopsis>
+ <para>
+ <function>getservbyport</function> returns the Internet service
+ associated with <parameter>port</parameter> for the specified
+ <parameter>protocol</parameter> as per /etc/services.
+ <parameter>protocol</parameter> is either <literal>TCP</literal>
+ or <literal>UDP</literal>.
+ </para>
+ <para>
+ Vedere anche: <function>getservbyname</function>.
+ </para>
+ </refsect1>
+ </refentry>
+
+ <refentry id="function.ip2long">
+ <refnamediv>
+ <refname>ip2long</refname>
+ <refpurpose>
+ Converts a string containing an (IPv4) Internet Protocol dotted address
+ into a proper address.
+ </refpurpose>
+ </refnamediv>
+ <refsect1>
+ <title>Descrizione</title>
+ <funcsynopsis>
+ <funcprototype>
+ <funcdef>int <function>ip2long</function></funcdef>
+ <paramdef>string <parameter>ip_address</parameter></paramdef>
+ </funcprototype>
+ </funcsynopsis>
+ <para>
+ The function <function>ip2long</function> generates an IPv4 Internet
+ network address from its Internet standard format (dotted string)
+ representation.
+ <example>
+ <title><function>ip2long</function> Example</title>
+ <programlisting role="php">
+<?php
+$ip = gethostbyname("www.php.net");
+$out = "The following URLs are equivalent:<br>\n";
+$out .= "http://www.php.net/, http://".$ip."/, and
+http://".sprintf("%u",ip2long($ip))."/<br>\n";
+echo $out;
+?>
+ </programlisting>
+ </example>
+ <note>
+ <para>
+ Because PHP's integer type is signed, and many IP addresses will
+ result in negative integers, you need to use the "%u" formatter of
+ <function>sprintf</function> or <function>printf</function> to get
+ the string representation of the unsigned IP address.
+ </para>
+ </note>
+ This second example shows how to print a converted address with the
+ <function>printf</function> function :
+ <example>
+ <title>Displaying an IP address</title>
+ <programlisting role="php">
+<?php
+$ip = gethostbyname("www.php.net");
+printf("%u\n", ip2long($ip));
+echo $out;
+?>
+ </programlisting>
+ </example>
+ </para>
+ <para>
+ Vedere anche: <function>long2ip</function>
+ </para>
+ </refsect1>
+ </refentry>
+
+ <refentry id="function.long2ip">
+ <refnamediv>
+ <refname>long2ip</refname>
+ <refpurpose>
+ Converts an (IPv4) Internet network address into a string in Internet
+ standard dotted format
+ </refpurpose>
+ </refnamediv>
+ <refsect1>
+ <title>Descrizione</title>
+ <funcsynopsis>
+ <funcprototype>
+ <funcdef>string <function>long2ip</function></funcdef>
+ <paramdef>int <parameter>proper_address</parameter></paramdef>
+ </funcprototype>
+ </funcsynopsis>
+ <para>
+ The function <function>long2ip</function> generates an Internet address
+ in dotted format (i.e.: aaa.bbb.ccc.ddd) from the proper address
+ representation.
+ </para>
+ <para>
+ Vedere anche: <function>ip2long</function>
+ </para>
+ </refsect1>
+ </refentry>
+
+ <refentry id="function.openlog">
+ <refnamediv>
+ <refname>openlog</refname>
+ <refpurpose>Open connection to system logger</refpurpose>
+ </refnamediv>
+ <refsect1>
+ <title>Descrizione</title>
+ <funcsynopsis>
+ <funcprototype>
+ <funcdef>int <function>openlog</function></funcdef>
+ <paramdef>string <parameter>ident</parameter></paramdef>
+ <paramdef>int <parameter>option</parameter></paramdef>
+ <paramdef>int <parameter>facility</parameter></paramdef>
+ </funcprototype>
+ </funcsynopsis>
+ <para>
+ <function>openlog</function> opens a connection to the system
+ logger for a program. The string <parameter>ident</parameter> is
+ added to each message. Values for <parameter>option</parameter>
+ and <parameter>facility</parameter> are given below.
+ The <parameter>option</parameter> argument is used to indicate
+ what loggin options will be used when generating a log message.
+ The <parameter>facility</parameter> argument is used to specify what
+ type of program is logging the message. This allows you to specify
+ (in your machine's syslog configuration) how messages coming from
+ different facilities will be handled.
+ The use of <function>openlog</function> is optional. It
+ will automatically be called by <function>syslog</function> if
+ necessary, in which case <parameter>ident</parameter> will default
+ to &false;.
+ </para>
+ <para>
+ <table>
+ <title><function>openlog</function> Options</title>
+ <tgroup cols="2">
+ <thead>
+ <row>
+ <entry>Constant</entry>
+ <entry>Descrizione</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>LOG_CONS</entry>
+ <entry>
+ if there is an error while sending data to the system logger,
+ write directly to the system console
+ </entry>
+ </row>
+ <row>
+ <entry>LOG_NDELAY</entry>
+ <entry>
+ open the connection to the logger immediately
+ </entry>
+ </row>
+ <row>
+ <entry>LOG_ODELAY</entry>
+ <entry>
+ (default) delay openning the connection until the first
+ message is logged
+ </entry>
+ </row>
+ <row>
+ <entry>LOG_PERROR</entry>
+ <entry>print log message also to standard error</entry>
+ </row>
+ <row>
+ <entry>LOG_PID</entry>
+ <entry>include PID with each message</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ You can use one or more of this options. When using multiple options
+ you need to <literal>OR</literal> them, i.e. to open the connection
+ immediately, write to the consoloe and include the PID in each message,
+ you will use: <literal>LOG_CONS | LOG_NDELAY | LOG_PID</literal>
+ </para>
+ <para>
+ <table>
+ <title><function>openlog</function> Facilities</title>
+ <tgroup cols="2">
+ <thead>
+ <row>
+ <entry>Constant</entry>
+ <entry>Descrizione</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>LOG_AUTH</entry>
+ <entry>
+ security/authorization messages (use LOG_AUTHPRIV instead
+ in systems where that constant is defined)
+ </entry>
+ </row>
+ <row>
+ <entry>LOG_AUTHPRIV</entry>
+ <entry>security/authorization messages (private)</entry>
+ </row>
+ <row>
+ <entry>LOG_CRON</entry>
+ <entry>clock daemon (cron and at)</entry>
+ </row>
+ <row>
+ <entry>LOG_DAEMON</entry>
+ <entry>other system daemons</entry>
+ </row>
+ <row>
+ <entry>LOG_KERN</entry>
+ <entry>kernel messages</entry>
+ </row>
+ <row>
+ <entry>LOG_LOCAL0 ... LOG_LOCAL7</entry>
+ <entry>reserved for local use</entry>
+ </row>
+ <row>
+ <entry>LOG_LPR</entry>
+ <entry>line printer subsystem</entry>
+ </row>
+ <row>
+ <entry>LOG_MAIL</entry>
+ <entry>mail subsystem</entry>
+ </row>
+ <row>
+ <entry>LOG_NEWS</entry>
+ <entry>USENET news subsystem</entry>
+ </row>
+ <row>
+ <entry>LOG_SYSLOG</entry>
+ <entry>messages generated internally by syslogd</entry>
+ </row>
+ <row>
+ <entry>LOG_USER</entry>
+ <entry>generic user-level messages</entry>
+ </row>
+ <row>
+ <entry>LOG_UUCP</entry>
+ <entry>UUCP subsystem</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ </para>
+ <para>
+ Vedere anche <function>define_syslog_variables</function>,
+ <function>syslog</function> and
+ <function>closelog</function>.
+ </para>
+ </refsect1>
+ </refentry>
+
+ <refentry id="function.pfsockopen">
+ <refnamediv>
+ <refname>pfsockopen</refname>
+ <refpurpose>
+ Open persistent Internet or Unix domain socket connection
+ </refpurpose>
+ </refnamediv>
+ <refsect1>
+ <title>Descrizione</title>
+ <funcsynopsis>
+ <funcprototype>
+ <funcdef>int <function>pfsockopen</function></funcdef>
+ <paramdef>string <parameter>hostname</parameter></paramdef>
+ <paramdef>int <parameter>port</parameter></paramdef>
+ <paramdef>int
+ <parameter><optional>errno</optional></parameter>
+ </paramdef>
+ <paramdef>string
+ <parameter><optional>errstr</optional></parameter>
+ </paramdef>
+ <paramdef>int
+ <parameter><optional>timeout</optional></parameter>
+ </paramdef>
+ </funcprototype>
+ </funcsynopsis>
+ <para>
+ This function behaves exactly as <function>fsockopen</function>
+ with the difference that the connection is not closed after the
+ script finishes. It is the persistent version of
+ <function>fsockopen</function>.
+ </para>
+ </refsect1>
+ </refentry>
+
+ <refentry id="function.socket-get-status">
+ <refnamediv>
+ <refname>socket_get_status</refname>
+ <refpurpose>
+ Returns information about existing socket resource
+ </refpurpose>
+ </refnamediv>
+ <refsect1>
+ <title>Descrizione</title>
+ <funcsynopsis>
+ <funcprototype>
+ <funcdef>array <function>socket_get_status</function></funcdef>
+ <paramdef>resource
+ <parameter>socket_get_status</parameter>
+ </paramdef>
+ </funcprototype>
+ </funcsynopsis>
+ <para>
+ Returns information about an existing socket resource. Currently
+ returns four entries in the result array:
+ </para>
+ <itemizedlist>
+ <listitem>
+ <para>
+ <parameter>timed_out</parameter> (bool) - The socket timed out
+ waiting for data
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <parameter>blocked</parameter> (bool) - The socket was blocked
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <parameter>eof</parameter> (bool) - Indicates EOF event
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <parameter>unread_bytes</parameter> (int) - Number of bytes
+ left in the socket buffer
+ </para>
+ </listitem>
+ </itemizedlist>
+ <para>
+ Vedere anche
+ <function>accept_connect</function>,
+ <function>bind</function>,
+ <function>connect</function>,
+ <function>listen</function>, and
+ <function>strerror</function>.
+ </para>
+ </refsect1>
+ </refentry>
+
+ <refentry id="function.socket-set-blocking">
+ <refnamediv>
+ <refname>socket_set_blocking</refname>
+ <refpurpose>Set blocking/non-blocking mode on a socket</refpurpose>
+ </refnamediv>
+ <refsect1>
+ <title>Descrizione</title>
+ <funcsynopsis>
+ <funcprototype>
+ <funcdef>int <function>socket_set_blocking</function></funcdef>
+ <paramdef>int <parameter>socket descriptor</parameter></paramdef>
+ <paramdef>int <parameter>mode</parameter></paramdef>
+ </funcprototype>
+ </funcsynopsis>
+ <para>
+ If <parameter>mode</parameter> is &false;, the given socket
+ descriptor will be switched to non-blocking mode, and if &true;, it
+ will be switched to blocking mode. This affects calls like
+ <function>fgets</function> that read from the socket. In
+ non-blocking mode an <function>fgets</function> call will always
+ return right away while in blocking mode it will wait for data to
+ become available on the socket.
+ </para>
+ <para>
+ This function was previously called as
+ <function>set_socket_blocking</function> but this usage is deprecated.
+ </para>
+ </refsect1>
+ </refentry>
+
+ <refentry id="function.socket-set-timeout">
+ <refnamediv>
+ <refname>socket_set_timeout</refname>
+ <refpurpose>Set timeout period on a socket</refpurpose>
+ </refnamediv>
+ <refsect1>
+ <title>Descrizione</title>
+ <funcsynopsis>
+ <funcprototype>
+ <funcdef>bool <function>socket_set_timeout</function></funcdef>
+ <paramdef>int <parameter>socket descriptor</parameter></paramdef>
+ <paramdef>int <parameter>seconds</parameter></paramdef>
+ <paramdef>int <parameter>microseconds</parameter></paramdef>
+ </funcprototype>
+ </funcsynopsis>
+ <para>
+ Sets the timeout value on <parameter>socket descriptor</parameter>,
+ expressed in the sum of <parameter>seconds</parameter> and
+ <parameter>microseconds</parameter>.
+ <example>
+ <title><function>socket_set_timeout</function> Example</title>
+ <programlisting role="php">
+<?php
+$fp = fsockopen("www.php.net", 80);
+if(!$fp) {
+ echo "Unable to open\n";
+} else {
+ fputs($fp,"GET / HTTP/1.0\n\n");
+ $start = time();
+ socket_set_timeout($fp, 2);
+ $res = fread($fp, 2000);
+ var_dump(socket_get_status($fp));
+ fclose($fp);
+ print $res;
+}
+?>
+ </programlisting>
+ </example>
+ </para>
+ <para>
+ This function was previously called as
+ <function>set_socket_timeout</function> but this usage is deprecated.
+ </para>
+ <para>
+ Vedere anche: <function>fsockopen</function> and <function>fopen</function>.
+ </para>
+ </refsect1>
+ </refentry>
+
+ <refentry id="function.syslog">
+ <refnamediv>
+ <refname>syslog</refname>
+ <refpurpose>Generate a system log message</refpurpose>
+ </refnamediv>
+ <refsect1>
+ <title>Descrizione</title>
+ <funcsynopsis>
+ <funcprototype>
+ <funcdef>int <function>syslog</function></funcdef>
+ <paramdef>int <parameter>priority</parameter></paramdef>
+ <paramdef>string <parameter>message</parameter></paramdef>
+ </funcprototype>
+ </funcsynopsis>
+ <para>
+ <function>syslog</function> generates a log message that will be
+ distributed by the system logger.
+ <parameter>priority</parameter> is a combination of the facility
+ and the level, values for which are given in the next section.
+ The remaining argument is the message to send, except that the
+ two characters <literal>%m</literal> will be replaced by the
+ error message string (strerror) corresponding to the present
+ value of <errortype>errno</errortype>.
+ </para>
+ <para>
+ <table>
+ <title><function>syslog</function> Priorities (in descending order)</title>
+ <tgroup cols="2">
+ <thead>
+ <row>
+ <entry>Constant</entry>
+ <entry>Descrizione</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>LOG_EMERG</entry>
+ <entry>system is unusable</entry>
+ </row>
+ <row>
+ <entry>LOG_ALERT</entry>
+ <entry>action must be taken immediately</entry>
+ </row>
+ <row>
+ <entry>LOG_CRIT</entry>
+ <entry>critical conditions</entry>
+ </row>
+ <row>
+ <entry>LOG_ERR</entry>
+ <entry>error conditions</entry>
+ </row>
+ <row>
+ <entry>LOG_WARNING</entry>
+ <entry>warning conditions</entry>
+ </row>
+ <row>
+ <entry>LOG_NOTICE</entry>
+ <entry>normal, but significant, condition</entry>
+ </row>
+ <row>
+ <entry>LOG_INFO</entry>
+ <entry>informational message</entry>
+ </row>
+ <row>
+ <entry>LOG_DEBUG</entry>
+ <entry>debug-level message</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ </para>
+ <para>
+ <example>
+ <title>Using <function>syslog</function></title>
+ <programlisting role="php">
+<?php
+define_syslog_variables();
+// open syslog, include the process ID and also send
+// the log to standard error, and use a user defined
+// logging mechanism
+openlog("myScripLog", LOG_PID | LOG_PERROR, LOG_LOCAL0);
+
+// some code
+
+if (authorized_client()) {
+ // do something
+} else {
+ // unauthorized client!
+ // log the attempt
+ $access = date("Y/m/d H:i:s");
+ syslog(LOG_WARNING,"Unauthorized client: $access $REMOTE_ADDR
+($HTTP_USER_AGENT)");
+}
+
+closelog();
+?>
+ </programlisting>
+ </example>
+ For information on setting up a user defined log handler, see the
+ <citerefentry><refentrytitle>syslog.conf</refentrytitle>
+ <manvolnum>5</manvolnum></citerefentry> Unix manual page. More
+ information on the syslog facilities and option can be found in the man
+ pages for <citerefentry><refentrytitle>syslog</refentrytitle>
+ <manvolnum>3</manvolnum></citerefentry> on Unix machines.
+ </para>
+ <para>
+ On Windows NT, the syslog service is emulated using the Event
+ Log.
+ </para>
+ <para>
+ Vedere anche <function>define_syslog_variables</function>,
+ <function>openlog</function> and
+ <function>closelog</function>.
+ </para>
+ </refsect1>
+ </refentry>
+
+ </reference>
+
+<!-- Keep this comment at the end of the file
+Local variables:
+mode: sgml
+sgml-omittag:t
+sgml-shorttag:t
+sgml-minimize-attributes:nil
+sgml-always-quote-attributes:t
+sgml-indent-step:1
+sgml-indent-data:t
+sgml-parent-document:nil
+sgml-default-dtd-file:"../../manual.ced"
+sgml-exposed-tags:nil
+sgml-local-catalogs:nil
+sgml-local-ecat-files:nil
+End:
+vim600: syn=xml fen fdm=syntax fdl=2 si
+vim: et tw=78 syn=sgml
+vi: ts=1 sw=1
+-->