(PECL stomp >= 0.1.0)
Stomp::__construct -- stomp_connect — Opens a connection
Stil obiect-orientat (constructor):
$broker = ini_get("stomp.default_broker_uri")
    [, string $username
    [, string $password
    [, array $headers
   ]]]] )Stil procedural:
$broker = ini_get("stomp.default_broker_uri")
    [, string $username
    [, string $password
    [, array $headers
   ]]]] )Opens a connection to a stomp compliant Message Broker.
brokerThe broker URI
usernameThe username.
passwordThe password.
headers
Un tablou asociativ conținând antetele suplimentare (de exemplu: receipt).
Notă:
Poate fi specificat un antet al tranzacției, indicând faptul că confirmarea mesajului trebuie să fie parte componentă a tranzacției cu nume.
| Versiune | Descriere | 
|---|---|
| 1.0.1 | 
        The headers parameter was added
        | 
      
Example #1 Stil obiect-orientat
<?php
/* connection */
try {
    $stomp = new Stomp('tcp://localhost:61613');
} catch(StompException $e) {
    die('Connection failed: ' . $e->getMessage());
}
/* close connection */
unset($stomp);
?>
Example #2 Stil procedural
<?php
/* connection */
$link = stomp_connect('ssl://localhost:61612');
/* check connection */
if (!$link) {
    die('Connection failed: ' . stomp_connect_error());
}
/* close connection */
stomp_close($link);
?>