note 105944 modified in amqpconnection.construct by danbrown
| From: | danbrown@php.net | Date: | Tue, 27 Sep 2011 14:25:09 +0000 |
| Subject: | note 105944 modified in amqpconnection.construct by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-183490@lists.php.net to get a copy of this message | ||
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();
// ...
?>
--was--
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();
...
?>
http://php.net/manual/en/amqpconnection.construct.php