php8.5
Home/ Manual/ network / functions/ pfsockopen

pfsockopen

PHP function Edit on GitHub ✎

(PHP 4, PHP 5, PHP 7, PHP 8)

Open persistent Internet or Unix domain socket connection

Description

pfsockopen(string $hostname, int $port = -1, int $error_code = null, string $error_message = null, float|null $timeout = null): resource|false

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().

Parameters

For parameter information, see the fsockopen() documentation.

Return Values

pfsockopen() returns a file pointer which may be used together with the other file functions (such as fgets(), fgetss(), fwrite(), fclose(), and feof()),Falseforfailure.

Changelog

VersionDescription
8.0.0timeout is nullable now.

See Also

Source: reference/network/functions/pfsockopen.xml · from the official PHP manual (php/doc-en)