Skip to content

Instantly share code, notes, and snippets.

@marlun
Created May 10, 2011 09:03
Show Gist options
  • Select an option

  • Save marlun/964136 to your computer and use it in GitHub Desktop.

Select an option

Save marlun/964136 to your computer and use it in GitHub Desktop.
$context = stream_context_create();
$result1 = stream_context_set_option($context, 'ssl', 'local_cert', $certPath);
$result2 = stream_context_set_option($context, 'ssl', 'passphrase', $certPass);
if (!$this->socket = stream_socket_client($target, $errno, $errstr, $timeout, STREAM_CLIENT_CONNECT, $context))
{
throw new Exception("Error connecting to $target: $errstr (code $errno)");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment