Skip to content

Instantly share code, notes, and snippets.

@undercloud
Created March 13, 2019 18:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save undercloud/d246473370aec7f19c2e42414ae00693 to your computer and use it in GitHub Desktop.
Save undercloud/d246473370aec7f19c2e42414ae00693 to your computer and use it in GitHub Desktop.
streams.php
<?php
$nl = "\r\n";
$headers = (
"GET / HTTP/1.1" . $nl .
"Host: www.ssllabs.com". $nl .
"User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:12.0) Gecko/20100101 Firefox/12.0". $nl .
"Content-Length: 0". $nl .
"Connection: close". $nl .
$nl
);
$context = stream_context_create([
'ssl' => [
'verify_peer_name' => false,
'verify_peer' => false
]
]);
$f = stream_socket_client('ssl://64.41.200.100:443',$a,$b,30,STREAM_CLIENT_CONNECT,$context);
var_dump(stream_socket_sendto($f,$headers));
echo stream_get_contents($f);
@undercloud
Copy link
Author

int(165)
WARNING stream_get_contents(): SSL operation failed with code 1. OpenSSL Error messages: error:1409442E:SSL routines:SSL3_READ_BYTES:tlsv1 alert protocol version on line number 24

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment