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