The network I/O functions send information directly over the Internet Protocol, or they fetch information about Internet hosts.
boolean checkdnsrr(string host, string type)
The checkdnsrr function checks DNS records for a host. The type argument defines the type of records for which to search. Valid types are listed. If type is not specified, checkdnsrr checks for MX records. You may wish to read the man page for named, the Internet domain name server daemon.
integer fsockopen(string hostname, integer port, integer eror_number, string error_description, double timeout)
The fsockopen begins a network connection as a file stream, returning a file descriptor suitable for use by fputs, fgets, and other file-stream functions discussed earlier in this chapter. A connection is attempted to the hostname at the given port. The hostname may also be a numerical IP address. The hostname may also be the path to a UNIX domain socket, in which case port should be set to 0. Some operating systems, specifically Windows, don't support UNIX domain sockets.
If an error occurs, FALSE is returned and the optional error_number and error_description arguments are set. They must be passed by reference, which means adding an ampersand (&) prior to the dollar sign. If the error number returned is zero, an error occurred before PHP tried to connect. This may indicate a problem initializing the socket.
The optional timeout argument will set the number of seconds PHP will wait for a connection to be established. You may specify fractions of a second as well, if you wish. The pfsockopen adds persistence to the fsockopen functionality.
string gethostbyaddr(string ip_address)
The gethostbyaddr function returns the name of the host specified by the numerical IP address. If the host cannot be resolved, the address is returned.
string gethostbyname(string hostname)
The gethostbyname function returns the IP address of the host specified by its name. It is possible a domain name resolves to more than one IP address. To get each one, use
array gethostbynamel(string hostname)
The gethostbynamel function returns a list of IP addresses that a given hostname resolves to.
boolean getmxrr(string host, array mxhost, array weight)
The getmxrr function gets mail-exchanger DNS records for a host. Hostnames will be added to the array specified by the mxhost argument. The optional weight array is assigned with the weight for each host. The return value signals whether the operation was successful.
integer getprotobyname(string name)
The getprotobyname function returns the number associated with a protocol.
string getprotobynumber(integer protocol)
The getprotobynumber function returns the name of a protocol given its number.
integer getservbyname(string service, string protocol)
The getservbyname function returns the port used by a service. The protocol argument
must be tcp or udp.
string getservbyport(integer service, string protocol)
The getservbyport function returns the name of the service that uses a specified port. The protocol argument must be tcp or udp.
boolean mail(string recipient, string subject, string body, string additional_headers)
The mail function sends email. Under UNIX it runs the sendmail shell command. Under Windows it makes a connection to an SMTP server. The mail is sent to the address specified in the recipient argument. You may specify multiple recipients by separating them with commas. You must also provide a subject and a message body.Optionally, you may provide additional headers in the fourth argument. Each extra header should be separated by a single newline character. If the mail is sent successfully, true is returned. On Windows, Date: and From: headers are added to the message automatically, unless you supply them yourself.
There are a few directives in php.ini for configuring this function. For Windows you can set the name of the SMTP host using the SMTP directive, and you can set the default From: header with the sendmail_from directive. It's valid, of course, to point to an SMTP server on the localhost. For UNIX, you may specify the path to your sendmail executable, which may have an acceptable default compiled in already. You can't set up PHP on UNIX to send mail directly to a remote SMTP host. You can configure sendmail to relay messages to a specific host, but the instructions are outside the scope of this text.<?
integer pfsockopen(string hostname, integer port, integererror_number, string error_description, double timeout)
The pfsockopen function operates identically to fsockopen, except that connections are cached. Connections opened with pfsockopen are not closed when a script terminates. They persist with the server process.
boolean set_socket_blocking(integer file_descriptor, booleanmode)
The set_socket_blocking function sets whether a file stream is blocking. In nonblocking mode, calls to functions that get information from the stream will return immediately with whatever data are in the input buffer. Blocking mode forces execution to halt until sufficient data are received.
PHP Related Interview Questions
|PHP Interview Questions||MySQL Interview Questions|
|PHP+MySQL Interview Questions||Drupal Interview Questions|
|MYSQL DBA Interview Questions||PHP5 Interview Questions|
|WordPress Interview Questions||Joomla Interview Questions|
|CakePHP Interview Questions||CodeIgniter Interview Questions|
|PHP7 Interview Questions|
All rights reserved © 2020 Wisdom IT Services India Pvt. Ltd
Wisdomjobs.com is one of the best job search sites in India.