fsockopen()
fsockopen - Open Internet or Unix domain socket connection
Syntax
resource fsockopen (
string $hostname,
int $port,
int &$errno,
string &$errstr,
float $timeout)
Arguments
- hostname - If you have compiled in OpenSSL support, you may prefix the hostname with either ssl://or tls://to use an SSL or TLS client connection over TCP/IP to connect to the remote host.
- port - The port number.
- errno - If provided, holds the system level error number that occurred in the system-level connect()call. If the value returned in errno is 0and 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.
- errstr - The error message as a string.
- timeout - The connection timeout, in seconds. Note: If you need to set a timeout for reading/writing data over the socket, use stream_set_timeout(), as the timeout parameter to fsockopen() only applies while connecting the socket.
Description
Initiates a socket connection to the resource specified by hostname.
Version
PHP 4, 5
Return value
fsockopen() returns a file pointer which may be used together with the other file functions (such as fgets(), fgetss(), fwrite(), fclose(), and feof()). If the call fails, it will return FALSE