Skip to content

Instantly share code, notes, and snippets.

/gist:786716
Created Jan 19, 2011

Embed
What would you like to do?
A demo of how to use amqphp
<?php
require 'amqp.php';
use amqp_091 as amqp;
use amqp_091\protocol;
use amqp_091\wire;
$params = array('username' => 'testing',
'userpass' => 'letmein',
'vhost' => 'robin',
'exchange' => 'unit-test-basic',
'socketImpl' => '\amqp_091\Socket',
'socketParams' => array(
'host' => 'localhost',
'port' => '5672'));
$c = new amqp\Connection($params);
$c->connect();
$chan = $c->getChannel();
$msg = $chan->basic('publish', array('content-type' => 'text/plain',
'content-encoding' => 'UTF-8',
'routing-key' => '',
'mandatory' => false,
'immediate' => false,
'exchange' => 'unit-test-basic'), 'This is the message content');
$chan->invoke($msg);
echo "Done!\n";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.