...

View Full Version : Check/Validate SSL certificate of external website



Devilshakerz
08-11-2012, 04:48 PM
Hey,

I want my web application to:
1. check if an specified external website (https://...) actually have the SSL certificate (can the connection be called relatively secure),
2. check if the SSL certificate is self-signed

Using cURL I can get some information about the certificate (in $info['certinfo']):

$ch = curl_init();
curl_setopt_array($ch, array(
CURLOPT_URL => 'https://www.google.com/',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_NOBODY => true,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HEADER => true,
CURLOPT_SSL_VERIFYPEER => false,
CURLOPT_CERTINFO => true,
));
curl_exec($ch);
$info = curl_getinfo($ch);
curl_close($ch);

But there's a question: how can I validate these information?
It should work like Internet browsers' green URL address bar or warning about self-signed certificate.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum