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 @@
+
+
+
+
+ Funzioni di rete
+ Rete
+
+
+
+ checkdnsrr
+
+ Controlla i record DNS relativi ad un host Internet o
+ indirizzo IP
+
+
+
+ Descrizione
+
+
+ int checkdnsrr
+ string host
+ string
+ type
+
+
+
+
+ Cerca i record DNS del tipo type
+ corrispondenti a host. Restituisce vero se
+ dei records sono trovati; falso se nessun record viene trovato
+ o in caso di errore.
+
+
+ type può essere uno dei seguenti: A, MX,
+ NS, SOA, PTR, CNAME, oppure ANY. Il default è MX.
+
+
+ Host può essere sia l'indirizzo IP in
+ notazione decimale o il nome dell'host.
+
+ ¬e.no-windows;
+
+ Vedere anche getmxrr,
+ gethostbyaddr,
+ gethostbyname,
+ gethostbynamel e la man page
+ named(8).
+
+
+
+
+
+
+ closelog
+ Chiude la connessione al logger di sistema
+
+
+ Descrizione
+
+
+ int closelog
+
+
+
+
+ closelog chiude il descrittore usato
+ per scrivere al logger di sistema. L'uso di
+ closelog è facoltativo.
+
+
+ Vedere anche define_syslog_variables,
+ syslog e
+ openlog.
+
+
+
+
+
+
+ debugger_off
+ Disattiva il debugger interno PHP
+
+
+ Descrizione
+
+
+ int debugger_off
+
+
+
+
+ Disattiva il debugger interno PHP. Il debugger è ancora in fase di
+ sviluppo.
+
+
+
+
+
+
+ debugger_on
+ Attiva il debugger interno PHP
+
+
+ Descrizione
+
+
+ int debugger_on
+ string address
+
+
+
+ Attiva il debugger interno PHP, connecting it to
+ address. The debugger is still under
+ development.
+
+
+
+
+
+
+ define_syslog_variables
+ Initializes all syslog related constants
+
+
+ Descrizione
+
+
+ void define_syslog_variables
+
+
+
+
+ Initializes all constants used in the syslog functions.
+
+
+ Vedere anche openlog,
+ syslog and
+ closelog.
+
+
+
+
+
+
+
+ fsockopen
+
+ Open Internet or Unix domain socket connection
+
+
+
+ Descrizione
+
+
+ int fsockopen
+
+ string udp://hostname
+
+ int port
+ int
+ errno
+
+ string
+ errstr
+
+ float
+ timeout
+
+
+
+
+ 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
+ hostname on port
+ port. hostname 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: udp://hostname. For the Unix
+ domain, hostname will be used as the path
+ to the socket, port must be set to 0 in
+ this case. The optional timeout can be
+ used to set a timeout in seconds for the connect system call.
+
+
+ fsockopen returns a file pointer which may
+ be used together with the other file functions (such as
+ fgets, fgetss,
+ fputs, fclose, and
+ feof).
+
+
+ If the call fails, it will return &false; and if the optional
+ errno and errstr
+ arguments are present they will be set to indicate the actual
+ system level error that occurred on the system-level
+ connect() call. If the returned errno is 0 and
+ the function returned &false;, it is an indication that the error
+ occurred before the connect() call. This is
+ most likely due to a problem initializing the socket. Note that
+ the errno and
+ errstr arguments must be passed by
+ reference.
+
+
+ Depending on the environment, the Unix domain or the optional
+ connect timeout may not be available.
+
+
+ The socket will by default be opened in blocking mode. You can
+ switch it to non-blocking mode by using
+ socket_set_blocking.
+
+ fsockopen Example
+
+$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);
+}
+
+
+ The example below shows how to retrieve the day and time
+ from the UDP service "daytime" (port 13) in your own machine.
+
+ Using UDP connection
+
+<?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);
+}
+?>
+
+
+
+ The timeout parameter was introduced in PHP 3.0.9 and
+ UDP support was added in PHP 4.
+
+
+ Vedere anche: pfsockopen,
+ socket_set_blocking,
+ socket_set_timeout, fgets,
+ fgetss, fputs,
+ fclose, and feof).
+
+
+
+
+
+
+ gethostbyaddr
+
+ Get the Internet host name corresponding to a given IP address
+
+
+
+ Descrizione
+
+
+ string gethostbyaddr
+ string ip_address
+
+
+
+ Returns the host name of the Internet host specified by
+ ip_address. If an error occurs, returns
+ ip_address.
+
+
+ Vedere anche gethostbyname.
+
+
+
+
+
+
+ gethostbyname
+
+ Get the IP address corresponding to a given Internet host name
+
+
+
+ Descrizione
+
+
+ string gethostbyname
+ string hostname
+
+
+
+ Returns the IP address of the Internet host specified by
+ hostname.
+
+
+ Vedere anche gethostbyaddr.
+
+
+
+
+
+
+ gethostbynamel
+
+ Get a list of IP addresses corresponding to a given Internet host
+ name
+
+
+
+ Descrizione
+
+
+ array gethostbynamel
+ string hostname
+
+
+
+ Returns a list of IP addresses to which the Internet host
+ specified by hostname resolves.
+
+
+ Vedere anche gethostbyname,
+ gethostbyaddr,
+ checkdnsrr, getmxrr,
+ and the named(8) manual page.
+
+
+
+
+
+
+ getmxrr
+
+ Get MX records corresponding to a given Internet host name
+
+
+
+ Descrizione
+
+
+ int getmxrr
+ string hostname
+ array mxhosts
+ array
+ weight
+
+
+
+
+ Searches DNS for MX records corresponding to
+ hostname. Returns &true; if any records are
+ found; returns &false; if no records were found or if an error
+ occurred.
+
+
+ A list of the MX records found is placed into the array
+ mxhosts. If the
+ weight array is given, it will be filled
+ with the weight information gathered.
+
+
+ Vedere anche checkdnsrr,
+ gethostbyname,
+ gethostbynamel,
+ gethostbyaddr, and the
+ named(8) manual page.
+
+
+
+
+
+
+ getprotobyname
+
+ Get protocol number associated with protocol name
+
+
+
+ Descrizione
+
+
+ int getprotobyname
+ string name
+
+
+
+ getprotobyname returns the protocol number
+ associated with the protocol name as per
+ /etc/protocols.
+
+
+ Vedere anche: getprotobynumber.
+
+
+
+
+
+
+ getprotobynumber
+
+ Get protocol name associated with protocol number
+
+
+
+ Descrizione
+
+
+ string getprotobynumber
+ int number
+
+
+
+ getprotobynumber returns the protocol name
+ associated with protocol number as per
+ /etc/protocols.
+
+
+ Vedere anche: getprotobyname.
+
+
+
+
+
+
+ getservbyname
+
+ Get port number associated with an Internet service and protocol
+
+
+
+ Descrizione
+
+
+ int getservbyname
+ string service
+ string protocol
+
+
+
+ getservbyname returns the Internet port
+ which corresponds to service for the
+ specified protocol as per
+ /etc/services.
+ protocol is either TCP
+ or UDP.
+
+
+ Vedere anche: getservbyport.
+
+
+
+
+
+
+ getservbyport
+
+ Get Internet service which corresponds to port and protocol
+
+
+
+ Descrizione
+
+
+ string getservbyport
+ int port
+ string protocol
+
+
+
+ getservbyport returns the Internet service
+ associated with port for the specified
+ protocol as per /etc/services.
+ protocol is either TCP
+ or UDP.
+
+
+ Vedere anche: getservbyname.
+
+
+
+
+
+
+ ip2long
+
+ Converts a string containing an (IPv4) Internet Protocol dotted address
+ into a proper address.
+
+
+
+ Descrizione
+
+
+ int ip2long
+ string ip_address
+
+
+
+ The function ip2long generates an IPv4 Internet
+ network address from its Internet standard format (dotted string)
+ representation.
+
+ ip2long Example
+
+<?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;
+?>
+
+
+
+
+ Because PHP's integer type is signed, and many IP addresses will
+ result in negative integers, you need to use the "%u" formatter of
+ sprintf or printf to get
+ the string representation of the unsigned IP address.
+
+
+ This second example shows how to print a converted address with the
+ printf function :
+
+ Displaying an IP address
+
+<?php
+$ip = gethostbyname("www.php.net");
+printf("%u\n", ip2long($ip));
+echo $out;
+?>
+
+
+
+
+ Vedere anche: long2ip
+
+
+
+
+
+
+ long2ip
+
+ Converts an (IPv4) Internet network address into a string in Internet
+ standard dotted format
+
+
+
+ Descrizione
+
+
+ string long2ip
+ int proper_address
+
+
+
+ The function long2ip generates an Internet address
+ in dotted format (i.e.: aaa.bbb.ccc.ddd) from the proper address
+ representation.
+
+
+ Vedere anche: ip2long
+
+
+
+
+
+
+ openlog
+ Open connection to system logger
+
+
+ Descrizione
+
+
+ int openlog
+ string ident
+ int option
+ int facility
+
+
+
+ openlog opens a connection to the system
+ logger for a program. The string ident is
+ added to each message. Values for option
+ and facility are given below.
+ The option argument is used to indicate
+ what loggin options will be used when generating a log message.
+ The facility 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 openlog is optional. It
+ will automatically be called by syslog if
+ necessary, in which case ident will default
+ to &false;.
+
+
+
+ openlog Options
+
+
+
+ Constant
+ Descrizione
+
+
+
+
+ LOG_CONS
+
+ if there is an error while sending data to the system logger,
+ write directly to the system console
+
+
+
+ LOG_NDELAY
+
+ open the connection to the logger immediately
+
+
+
+ LOG_ODELAY
+
+ (default) delay openning the connection until the first
+ message is logged
+
+
+
+ LOG_PERROR
+ print log message also to standard error
+
+
+ LOG_PID
+ include PID with each message
+
+
+
+
+ You can use one or more of this options. When using multiple options
+ you need to OR them, i.e. to open the connection
+ immediately, write to the consoloe and include the PID in each message,
+ you will use: LOG_CONS | LOG_NDELAY | LOG_PID
+
+
+
+ openlog Facilities
+
+
+
+ Constant
+ Descrizione
+
+
+
+
+ LOG_AUTH
+
+ security/authorization messages (use LOG_AUTHPRIV instead
+ in systems where that constant is defined)
+
+
+
+ LOG_AUTHPRIV
+ security/authorization messages (private)
+
+
+ LOG_CRON
+ clock daemon (cron and at)
+
+
+ LOG_DAEMON
+ other system daemons
+
+
+ LOG_KERN
+ kernel messages
+
+
+ LOG_LOCAL0 ... LOG_LOCAL7
+ reserved for local use
+
+
+ LOG_LPR
+ line printer subsystem
+
+
+ LOG_MAIL
+ mail subsystem
+
+
+ LOG_NEWS
+ USENET news subsystem
+
+
+ LOG_SYSLOG
+ messages generated internally by syslogd
+
+
+ LOG_USER
+ generic user-level messages
+
+
+ LOG_UUCP
+ UUCP subsystem
+
+
+
+
+
+
+ Vedere anche define_syslog_variables,
+ syslog and
+ closelog.
+
+
+
+
+
+
+ pfsockopen
+
+ Open persistent Internet or Unix domain socket connection
+
+
+
+ Descrizione
+
+
+ int pfsockopen
+ string hostname
+ int port
+ int
+ errno
+
+ string
+ errstr
+
+ int
+ timeout
+
+
+
+
+ This function behaves exactly as fsockopen
+ with the difference that the connection is not closed after the
+ script finishes. It is the persistent version of
+ fsockopen.
+
+
+
+
+
+
+ socket_get_status
+
+ Returns information about existing socket resource
+
+
+
+ Descrizione
+
+
+ array socket_get_status
+ resource
+ socket_get_status
+
+
+
+
+ Returns information about an existing socket resource. Currently
+ returns four entries in the result array:
+
+
+
+
+ timed_out (bool) - The socket timed out
+ waiting for data
+
+
+
+
+ blocked (bool) - The socket was blocked
+
+
+
+
+ eof (bool) - Indicates EOF event
+
+
+
+
+ unread_bytes (int) - Number of bytes
+ left in the socket buffer
+
+
+
+
+ Vedere anche
+ accept_connect,
+ bind,
+ connect,
+ listen, and
+ strerror.
+
+
+
+
+
+
+ socket_set_blocking
+ Set blocking/non-blocking mode on a socket
+
+
+ Descrizione
+
+
+ int socket_set_blocking
+ int socket descriptor
+ int mode
+
+
+
+ If mode 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
+ fgets that read from the socket. In
+ non-blocking mode an fgets call will always
+ return right away while in blocking mode it will wait for data to
+ become available on the socket.
+
+
+ This function was previously called as
+ set_socket_blocking but this usage is deprecated.
+
+
+
+
+
+
+ socket_set_timeout
+ Set timeout period on a socket
+
+
+ Descrizione
+
+
+ bool socket_set_timeout
+ int socket descriptor
+ int seconds
+ int microseconds
+
+
+
+ Sets the timeout value on socket descriptor,
+ expressed in the sum of seconds and
+ microseconds.
+
+ socket_set_timeout Example
+
+<?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;
+}
+?>
+
+
+
+
+ This function was previously called as
+ set_socket_timeout but this usage is deprecated.
+
+
+ Vedere anche: fsockopen and fopen.
+
+
+
+
+
+
+ syslog
+ Generate a system log message
+
+
+ Descrizione
+
+
+ int syslog
+ int priority
+ string message
+
+
+
+ syslog generates a log message that will be
+ distributed by the system logger.
+ priority 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 %m will be replaced by the
+ error message string (strerror) corresponding to the present
+ value of errno.
+
+
+
+
+
+
+ Using syslog
+
+<?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();
+?>
+
+
+ For information on setting up a user defined log handler, see the
+ syslog.conf
+ 5 Unix manual page. More
+ information on the syslog facilities and option can be found in the man
+ pages for syslog
+ 3 on Unix machines.
+
+
+ On Windows NT, the syslog service is emulated using the Event
+ Log.
+
+
+ Vedere anche define_syslog_variables,
+ openlog and
+ closelog.
+
+
+
+
+
+
+