Title: Fsockopen::test
Published: March 29, 2023
Last modified: November 8, 2023

---

# Fsockopen::test( $capabilities = array() ): bool

## In this article

 * [Description](https://developer.wordpress.org/reference/classes/wporg-requests-transport-fsockopen/test/?output_format=md#description)
 * [Parameters](https://developer.wordpress.org/reference/classes/wporg-requests-transport-fsockopen/test/?output_format=md#parameters)
 * [Return](https://developer.wordpress.org/reference/classes/wporg-requests-transport-fsockopen/test/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/classes/wporg-requests-transport-fsockopen/test/?output_format=md#source)

Self-test whether the transport can be used.

## 󠀁[Description](https://developer.wordpress.org/reference/classes/wporg-requests-transport-fsockopen/test/?output_format=md#description)󠁿

The available capabilities to test for can be found in \WpOrg\Requests\Capability.

## 󠀁[Parameters](https://developer.wordpress.org/reference/classes/wporg-requests-transport-fsockopen/test/?output_format=md#parameters)󠁿

bool> $capabilities Optional. Associative array of capabilities to test against,
i.e. `[<capability> => true]`.

## 󠀁[Return](https://developer.wordpress.org/reference/classes/wporg-requests-transport-fsockopen/test/?output_format=md#return)󠁿

 bool Whether the transport can be used.

## 󠀁[Source](https://developer.wordpress.org/reference/classes/wporg-requests-transport-fsockopen/test/?output_format=md#source)󠁿

    ```php
    /**
     * Self-test whether the transport can be used.
     *
     * The available capabilities to test for can be found in \WpOrg\Requests\Capability.
     *
     * @codeCoverageIgnore
     * @param array<string, bool> $capabilities Optional. Associative array of capabilities to test against, i.e. `['<capability>' => true]`.
     * @return bool Whether the transport can be used.
     */
    public static function test($capabilities = []) {
    	if (!function_exists('fsockopen')) {
    		return false;
    	}
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/requests/src/transport/fsockopen.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.1/src/wp-includes/Requests/src/Transport/Fsockopen.php#L496)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.1/src/wp-includes/Requests/src/Transport/Fsockopen.php#L496-L509)

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwporg-requests-transport-fsockopen%2Ftest%2F)
before being able to contribute a note or feedback.