HTTPSプロトコルのサポートを確認し、phpinfo()情報を配列に保存する方法は次のとおりです。
// NOTE: This section was extracted from the PHP Manual, example from **jon at sitewizard dot ca**
ob_start();
phpinfo();
$PHPInfo = array( 'phpinfo' => array() );
if ( preg_match_all( '#(?:<h2>(?:<a name=".*?">)?(.*?)(?:</a>)?</h2>)|(?:<tr(?: class=".*?")?><t[hd](?: class=".*?")?>(.*?)\s*</t[hd]>(?:<t[hd](?: class=".*?")?>(.*?)\s*</t[hd]>(?:<t[hd](?: class=".*?")?>(.*?)\s*</t[hd]>)?)?</tr>)#s',
ob_get_clean(), $Matches, PREG_SET_ORDER )
) {
foreach ( $Matches as $Value ) {
if ( strlen( $Value[ 1 ] ) ) {
$PHPInfo[ $Value[ 1 ] ] = array();
}
elseif ( isset( $Value[ 3 ] ) ) {
$PHPInfo[ end( array_keys( $PHPInfo ) ) ][ $Value[ 2 ] ] = isset( $Value[ 4 ] ) ? array( $Value[ 3 ],
$Value[ 4 ] ) : $Value[ 3 ];
}
else {
$PHPInfo[ end( array_keys( $PHPInfo ) ) ][ ] = $Value[ 2 ];
}
}
}
// End of extracted section ----------------------
$HTTPS = $PHPInfo[ 'curl' ][ 'Protocols' ];
$HTTPSFound = mb_strstr( $HTTPS, 'https', FALSE );
if ( $HTTPSFound ) {
echo "HTTPS supported<br /><br />";
}
else {
echo "HTTPS NOT supported<br /><br />";
}
追記:この回答は「手動チェック」を必要としません。スクリプトを介して情報を取得します!