<?php
/**
* Put file test_ssl.php to WP root and open it in browser.
* If you get some error about SSL in green block:
* * SSL connection timeout - can be temporary issue with remote website or local server firewall (blocked connection with remote host)
* * SSL: CA certificate set, but certificate verification is disabled - enable SSL verifycation in Apache
*/
/* Initiate WordPress */
define( 'WP_USE_THEMES', false );
require( './wp-blog-header.php' );
/* Define HTTPS URL to test */
$url = 'https://www.googleapis.com/youtube/v3/playlistItems';
/* Request URL with and w/o SSL verify */
$res_sslverify = wp_remote_get( $url );
$res_nosslverify = wp_remote_get( $url, array( 'sslverify' => false ) );
/* Print output */
printf(
'%s<br><pre class="verify">Verified SSL:<br/>%s</pre><pre class="noverify">Not verified SSL:<br/>%s</pre>',
$url,
print_r( $res_sslverify, 1 ),
print_r( $res_nosslverify, 1 )
);
?>
<style>
pre { width:50%; float:left; padding: 5px; box-sizing:border-box;}
.verify { background: green; }
.noverify { background: red; }
</style>
Comments