note 105944 deleted from amqpconnection.construct by sobak
| From: | sobak@php.net | Date: | Thu, 24 Nov 2016 20:34:43 +0000 |
| Subject: | note 105944 deleted from amqpconnection.construct by sobak | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-207588@lists.php.net to get a copy of this message | ||
Note Submitter: bolo at nospam dot autistici dot org
----
A simply function that help manage connections to AMQP server.
It works fine in debian wheezy php 5.3.8.
Change Login & Password value at your plasure.
(Host will be the default value = 127.0.0.1).
<?php
function amqp_connection() {
$connection = new AMQPConnection();
$connection->setLogin('guest');
$connection->setPassword('guest');
$connection->connect();
if (!$connection->isConnected()) {
echo "Cannot connect to the broker";
}
return $connection;
}
//Next manage the connection with $connection var
// function ...
// $connection=amqp_connection();
// ...
?>