wp_remote_fopen

The timeline below displays how wordpress function wp_remote_fopen has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 5.5

/**
 * HTTP request for URI to retrieve content.
 *
 * @since 1.5.1
 *
 * @see wp_safe_remote_get()
 *
 * @param string $uri URI/URL of web page to retrieve.
 * @return string|false HTTP content. False on failure.
 */
function wp_remote_fopen($uri)
{
    $parsed_url = parse_url($uri);
    if (!$parsed_url || !is_array($parsed_url)) {
        return false;
    }
    $options = array();
    $options['timeout'] = 10;
    $response = wp_safe_remote_get($uri, $options);
    if (is_wp_error($response)) {
        return false;
    }
    return wp_remote_retrieve_body($response);
}

WordPress Version: 5.4

/**
 * HTTP request for URI to retrieve content.
 *
 * @since 1.5.1
 *
 * @see wp_safe_remote_get()
 *
 * @param string $uri URI/URL of web page to retrieve.
 * @return string|false HTTP content. False on failure.
 */
function wp_remote_fopen($uri)
{
    $parsed_url = @parse_url($uri);
    if (!$parsed_url || !is_array($parsed_url)) {
        return false;
    }
    $options = array();
    $options['timeout'] = 10;
    $response = wp_safe_remote_get($uri, $options);
    if (is_wp_error($response)) {
        return false;
    }
    return wp_remote_retrieve_body($response);
}

WordPress Version: 4.1

/**
 * HTTP request for URI to retrieve content.
 *
 * @since 1.5.1
 *
 * @see wp_safe_remote_get()
 *
 * @param string $uri URI/URL of web page to retrieve.
 * @return false|string HTTP content. False on failure.
 */
function wp_remote_fopen($uri)
{
    $parsed_url = @parse_url($uri);
    if (!$parsed_url || !is_array($parsed_url)) {
        return false;
    }
    $options = array();
    $options['timeout'] = 10;
    $response = wp_safe_remote_get($uri, $options);
    if (is_wp_error($response)) {
        return false;
    }
    return wp_remote_retrieve_body($response);
}

WordPress Version: 4.0

/**
 * HTTP request for URI to retrieve content.
 *
 * @since 1.5.1
 *
 * @see wp_safe_remote_get()
 *
 * @param string $uri URI/URL of web page to retrieve.
 * @return bool|string HTTP content. False on failure.
 */
function wp_remote_fopen($uri)
{
    $parsed_url = @parse_url($uri);
    if (!$parsed_url || !is_array($parsed_url)) {
        return false;
    }
    $options = array();
    $options['timeout'] = 10;
    $response = wp_safe_remote_get($uri, $options);
    if (is_wp_error($response)) {
        return false;
    }
    return wp_remote_retrieve_body($response);
}

WordPress Version: 3.7

/**
 * HTTP request for URI to retrieve content.
 *
 * @since 1.5.1
 * @uses wp_remote_get()
 *
 * @param string $uri URI/URL of web page to retrieve.
 * @return bool|string HTTP content. False on failure.
 */
function wp_remote_fopen($uri)
{
    $parsed_url = @parse_url($uri);
    if (!$parsed_url || !is_array($parsed_url)) {
        return false;
    }
    $options = array();
    $options['timeout'] = 10;
    $response = wp_safe_remote_get($uri, $options);
    if (is_wp_error($response)) {
        return false;
    }
    return wp_remote_retrieve_body($response);
}