Definition:
function url_is_accessable_via_ssl($url)
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.
Parameters
- string $url
Return values
returns:Whether SSL access is available
Source code
function url_is_accessable_via_ssl($url) { if (in_array('curl', get_loaded_extensions())) { $ssl = preg_replace( '/^http:\/\//', 'https://', $url ); $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; }
3267
No comments yet... Be the first to leave a reply!