<?php

ini_set( 'display_errors', true );
error_reporting( E_ALL );

echo "WITH VERIFY_PEER\n";
$context = stream_context_create( array(
	'ssl' => array(
		'verify_peer' => true,
	),
) );

$a = fopen( 'https://wordpress.org/', 'r', false, $context );
echo $a ? "YES" : "NO";
echo "\n";

echo "\n";

echo "WITHOUT VERIFY_PEER\n";
$context = stream_context_create( array(
	'ssl' => array(
		'verify_peer' => false
	),
) );

$a = fopen( 'https://wordpress.org/', 'r', false, $context );
echo $a ? "YES" : "NO";
echo "\n";

echo "\n";

echo "CURL CONTROL\n";
$c = curl_init( 'https://wordpress.org/' );
curl_setopt_array( $c, array(
	CURLOPT_NOBODY => true,
	CURLOPT_SSL_VERIFYHOST => true,
	CURLOPT_SSL_VERIFYPEER => true,
) );
$a = curl_exec( $c );
echo $a ? "YES" : "NO";
echo "\n";
