Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

demo SSL connection script

  • Loading branch information...
commit fbbab692d9331922a76735332642ec124c462b88 1 parent c12029a
@videlalvaro videlalvaro authored
Showing with 31 additions and 0 deletions.
  1. +31 −0 demo/ssl_connection.php
View
31 demo/ssl_connection.php
@@ -0,0 +1,31 @@
+<?php
+
+require_once(__DIR__ . '/../amqp.inc');
+
+define('HOST', 'localhost');
+define('PORT', 5671);
+define('USER', 'guest');
+define('PASS', 'guest');
+define('VHOST', '/');
+
+//If this is enabled you can see AMQP output on the CLI
+define('AMQP_DEBUG', true);
+
+define('CERTS_PATH',
+ '/git/rabbitmqinaction/av_scratchwork/openssl');
+
+$ssl_options = array(
+ 'cafile' => CERTS_PATH . '/rmqca/cacert.pem',
+ 'local_cert' => CERTS_PATH . '/phpcert.pem',
+ 'verify_peer' => true
+ );
+
+$conn = new AMQPSSLConnection(HOST, PORT, USER, PASS, VHOST, $ssl_options);
+
+function shutdown($conn){
+ $conn->close();
+}
+
+register_shutdown_function('shutdown', $conn);
+
+while(1){}
Please sign in to comment.
Something went wrong with that request. Please try again.