This was really helpful, I needed an SSL version where the client didn’t need to have certificate and it took no time to implement once the server side was working (followed https://www.rabbitmq.com/ssl.html for the server). Here is my sender code:

[code]
”,
‘cafile’ => ”, // no cert required
‘verify_peer’ => false,
);

#$connection = new AMQPStreamConnection(‘host’, 5671, ‘username’, ‘password’);
$connection = new AMQPSSLConnection(‘host’,5671, ‘username’,’password’, ‘/’, $ssl_options);

$channel = $connection->channel();

$channel->exchange_declare(‘exchange_name’, ‘direct’, false, true, false);
$channel->queue_declare($queue, false, true, false, false);
$channel->queue_bind($queue, ‘exchange_name’, $routingkey);

$data = implode(‘ ‘, array_slice($argv, 2));
if(empty($data)) $data = “Hello World!”;

$msg = new AMQPMessage($data,array(‘delivery_mode’ => 2)); # make message persistent

$channel->basic_publish($msg, ‘exchange_name’, $routingkey);

echo ” [x] Sent “,$queue,’:’,$data,” \n”;

$channel->close();
$connection->close();

?>
[/code]