-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
27 lines (24 loc) · 683 Bytes
/
Copy pathindex.php
File metadata and controls
27 lines (24 loc) · 683 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<?php
require_once __DIR__ . '/vendor/autoload.php';
use PhpAmqpLib\Connection\AMQPStreamConnection;
use PhpAmqpLib\Message\AMQPMessage;
function publish($msg){
// Ajustar o IP conforme o seu docker
$connection = new AMQPStreamConnection('172.17.0.2', 5672, 'guest', 'guest');
$channel = $connection->channel();
$channel->queue_declare('hello', false, false, false, false);
$qMsg = new AMQPMessage($msg);
$channel->basic_publish($qMsg, '', 'hello');
}
if(isset($_POST['msg'])){
publish($_POST['msg']);
}
?>
<html>
<body>
<form method="post">
<input type="text" value="" name ="msg" autofocus />
<input type="submit" value="Enviar para fila" />
</form>
<body>
</html>