I'd like to write a php script that will check a list of URLs in an array and return whether that URL resolves successfully or whether there is a security error.
Specifically I'm trying to detect the "this page is not secure" message that appears when you visit a site using https:// that doesn't have a valid SSL certificate.
So I figured I'd use a foreach loop to cycle through the array testing each URL. then echo either success, or error depending on whether it encounters a security error.
$urls = array(
'https://one.com',
'https://two.com',
'https://three.com'
);
foreach( $urls as $key => $value){
//look up current domain name. if it resolves echo "success"
//else if an SSL error is encountered echo "error"
}
Sorry I haven't gotten very far. Not sure where to start. Does anyone know a simple way to do this?
thanks.