Menu Search

recv.php

<?php



include("proton.php");

$mess = new Messenger();
$mess->start();

if ($argv[1]) {
  $mess->subscribe($argv[1]);
} else {
  $mess->subscribe("amqp://~0.0.0.0");
}

$msg = new Message();
while (true) {
  $mess->recv(10);
  while ($mess->incoming) {
    try {
      $mess->get($msg);
    } catch (Exception $e) {
      print "$e\n";
      continue;
    }

    print "$msg->address, $msg->subject, $msg->body\n";
  }
}

$mess->stop();
?>

Download this file