[rabbitmq-discuss] connot connect

aaron kenny aaron.kenny at gmail.com
Thu Apr 10 13:30:56 BST 2014


Hello All,

below script wont create a connection for me and I'm a little unsure how to 
determine what might be causing the issue. Im connecting to a server which 
im told defo works. As a test I changed the connection host to 
local/guest/guest and it work fine.

Any ideas would be much appriciated as im totally out of ideas.


<?php

require_once __DIR__ . '/vendor/autoload.php';
use PhpAmqpLib\Connection\AMQPConnection;
use PhpAmqpLib\Message\AMQPMessage;



$connection = new AMQPConnection('subdomain.somedomain.com', '', '', '');
$channel = $connection->channel();

$channel->exchange_declare('gbs_prod_x2', 'direct', false, false, false);
$channel->queue_declare("", false, true, true, false);


if(!empty($argv[1]))
{
$data = implode(' ', array_slice($argv, 2));
}
else if(isset($_REQUEST['data']))
{
$data = urldecode($_REQUEST['data']);
}
else
{
$data = "Hello from Aaron in London";
}



//SET THE SEVERITY
if(empty($severity))
{
if(isset($_REQUEST['severity']))
{
$severity = $_REQUEST['severity'];
} 
else if(!empty($argv[1]))
{
$severity = $argv[1];
}
else 
{
$severity = "info";
}
} 
echo $severity;
$msg = new AMQPMessage($data);

$channel->basic_publish($msg, 'direct_logs', $severity);

echo " [x] Sent ",$severity,':',$data," \n";

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

?>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20140410/5ee7fc3a/attachment.html>


More information about the rabbitmq-discuss mailing list