PhpRiot
Become Zend Certified

Prepare for the ZCE exam using our quizzes (web or iPad/iPhone). More info...


When you're ready get 7.5% off your exam voucher using voucher CJQNOV23 at the Zend Store

AMQPConnection::connect

(PECL amqp >= Unknown)

AMQPConnection::connectEstablish a connection with the AMQP broker.

Description

public bool AMQPConnection::connect ( void )

This method will initiate a connection with the AMQP broker.

Parameters

This function has no parameters.

Return Values

Returns TRUE on success or FALSE on failure.

Examples

Example #1 AMQPConnection::connect example

<?php

/* Create a new connection */
$cnn = new AMQPConnection();

// set the login details
$cnn->setLogin('mylogin');
$cnn->setPassword('mypass');

if (
$cnn->connect()) {
    echo 
"Established a connection to the broker";
}
else {
    echo 
"Cannot connect to the broker";
}


?>

PHP Manual