Hi,
i recently have this issue with
stream_socket_client() [function.stream-socket-client]: php_network_getaddresses: getaddrinfo failed: No such host is known.
It worked, but i cannot reproduce the other servers configuration as that machine literally burned.
The code is for retrieveing a security certificate from a partner site.
$url = '[verified host]/ws/pub/WSAuthSubService?wsdl'; // For example
$context = stream_context_create();
$res = stream_context_set_option($context, 'ssl', 'capture_peer_cert', true);
$res = stream_context_set_option($context, 'ssl', 'verify_host', true);
//stream_socket_client("$mode://ssl.example.de:443/", $errno, $errstr, 30, STREAM_CLIENT_CONNECT, $context)
if ($socket = stream_socket_client("tls://$url:443", $errno, $errstr, 30, STREAM_CLIENT_CONNECT, $context))
{
if ($options = stream_context_get_options($context))
{
if ( isset ($options['ssl']) && isset ($options['ssl']['peer_certificate']))
{
$keyinfo = openssl_x509_export_to_file($options['ssl']['peer_certificate'], DIR_APP.'/res/api/[dir]/'.$filename);
}
}
}