Make WordPress Core

Ticket #16606: test-https-request-methods.php

File test-https-request-methods.php, 782 bytes (added by mdawaffe, 13 years ago)
Line 
1<?php
2
3ini_set( 'display_errors', true );
4error_reporting( E_ALL );
5
6echo "WITH VERIFY_PEER\n";
7$context = stream_context_create( array(
8        'ssl' => array(
9                'verify_peer' => true,
10        ),
11) );
12
13$a = fopen( 'https://wordpress.org/', 'r', false, $context );
14echo $a ? "YES" : "NO";
15echo "\n";
16
17echo "\n";
18
19echo "WITHOUT VERIFY_PEER\n";
20$context = stream_context_create( array(
21        'ssl' => array(
22                'verify_peer' => false
23        ),
24) );
25
26$a = fopen( 'https://wordpress.org/', 'r', false, $context );
27echo $a ? "YES" : "NO";
28echo "\n";
29
30echo "\n";
31
32echo "CURL CONTROL\n";
33$c = curl_init( 'https://wordpress.org/' );
34curl_setopt_array( $c, array(
35        CURLOPT_NOBODY => true,
36        CURLOPT_SSL_VERIFYHOST => true,
37        CURLOPT_SSL_VERIFYPEER => true,
38) );
39$a = curl_exec( $c );
40echo $a ? "YES" : "NO";
41echo "\n";