wpseek.com
WordPress开发者和主题制作者的搜索引擎



url_is_accessable_via_ssl › WordPress Function

Since2.5.0
已弃用4.0.0
url_is_accessable_via_ssl ( $url )
参数:
  • (string) $url The URL to test.
    Required: Yes
返回:
  • (bool) Whether SSL access is available.
定义在:
文档:

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.


源码

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;
}