# Some may find it useful to know that your caCert
# must be in pem format, and that PHP seems to like
# your key, cert, and cacert pem's to be concatenated
# in a single file (I suffered various "unknown
chain"
# errors, otherwise)
#
# So, (linux users), concat your components as follows:
# (where current working dir is dir where
# cert components are stored)
#
# cat key.pem >certchain.pem
# cat cert.pem >>certchain.pem
# cat cacert.pem >>certchain.pem
#
# Then, the php....
##################################
<?php
$host = 'host.domain.tld';
$port = 1234;
$timeout = 10;
$cert = '/path/to/your/certchain/certchain.pem';
$context =
stream_context_create(array('ssl'=>array('local_cert'=>
; $cert,
)));
if ($fp = stream_socket_client('ssl://'.$host.':'.$port,
$errno, $errstr, 30,
STREAM_CLIENT_CONNECT, $context)) {
fwrite($fp, "n");
echo fread($fp,8192);
fclose($fp);
} else {
echo "ERROR: $errno - $errstr<br />n";
}
?>
----
Server IP: 64.71.164.2
Probable Submitter: 66.114.90.6
----
Manual Page -- http://www.php.net/manual/en/function.stream-socke
t-client.php
Edit -- https://master
.php.net/note/edit/77497
Del: integrated -- h
ttps://master.php.net/note/delete/77497/integrated
Del: useless -- http
s://master.php.net/note/delete/77497/useless
Del: bad code -- htt
ps://master.php.net/note/delete/77497/bad+code
Del: spam -- https:/
/master.php.net/note/delete/77497/spam
Del: non-english --
https://master.php.net/note/delete/77497/non-english
Del: in docs -- http
s://master.php.net/note/delete/77497/in+docs
Del: other reasons-- https://mast
er.php.net/note/delete/77497
Reject -- https://mast
er.php.net/note/reject/77497
Search -- https://
master.php.net/manage/user-notes.php
--
PHP Notes Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub
.php
|