Menu Riverview Church

PFSOCKOPEN

Open persistent Internet or Unix domain socket connection

SYNTAX

pfsockopen ( string $hostname [, int $port = -1 [, int &$errno [, string &$errstr [, float $timeout = ini_get("default_socket_timeout") ]]]] ) : resource

PARAMETERS

hostname

If OpenSSL support is installed, 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. This can be omitted and skipped with -1 for transports that do not use ports, such as unix://.

errno

If provided, holds the system level error number that occurred in the system-level connect() call. If the value returned in 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.

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.

RETURN

EXAMPLES

1

HTTP/1.1 301 Moved Permanently
Server: myracloud
Date: Sun, 25 Oct 2020 23:09:48 GMT
Content-Type: text/html
Content-Length: 161
Connection: close
Location: https://www.php.net/

<html>
<head><title>301 Moved Permanently</title></head>
<body>
<center><h1>301 Moved Permanently</h1></center>
<hr><center>Myra</center>
</body>
</html>

PHP