url_is_accessable_via_ssl

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

WordPress Version: 4.6

/**
 * Determines if the URL can be accessed over SSL.
 *
 * Determines if the URL can be accessed over SSL by using the WordPress HTTP API to access
 * the URL using https as the scheme.
 *
 * @since 2.5.0
 * @deprecated 4.0.0
 *
 * @param string $url The URL to test.
 * @return bool Whether SSL access is available.
 */
function url_is_accessable_via_ssl($url)
{
    _deprecated_function(__FUNCTION__, '4.0.0');
    $response = wp_remote_get(set_url_scheme($url, 'https'));
    if (!is_wp_error($response)) {
        $status = wp_remote_retrieve_response_code($response);
        if (200 == $status || 401 == $status) {
            return true;
        }
    }
    return false;
}

WordPress Version: 4.0

/**
 * Determines if the URL can be accessed over SSL.
 *
 * Determines if the URL can be accessed over SSL by using the WordPress HTTP API to access
 * the URL using https as the scheme.
 *
 * @since 2.5.0
 * @deprecated 4.0.0
 *
 * @param string $url The URL to test.
 * @return bool Whether SSL access is available.
 */
function url_is_accessable_via_ssl($url)
{
    _deprecated_function(__FUNCTION__, '4.0');
    $response = wp_remote_get(set_url_scheme($url, 'https'));
    if (!is_wp_error($response)) {
        $status = wp_remote_retrieve_response_code($response);
        if (200 == $status || 401 == $status) {
            return true;
        }
    }
    return false;
}

WordPress Version: 3.7

/**
 * Determines if the blog can be accessed over SSL.
 *
 * Determines if blog can be accessed over SSL by using cURL to access the site
 * using the https in the siteurl. Requires cURL extension to work correctly.
 *
 * @since 2.5.0
 *
 * @param string $url
 * @return bool Whether SSL access is available
 */
function url_is_accessable_via_ssl($url)
{
    if (in_array('curl', get_loaded_extensions())) {
        $ssl = set_url_scheme($url, 'https');
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $ssl);
        curl_setopt($ch, CURLOPT_FAILONERROR, true);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
        curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
        curl_exec($ch);
        $status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
        curl_close($ch);
        if ($status == 200 || $status == 401) {
            return true;
        }
    }
    return false;
}