Stomp::__construct

stomp_connect

Opens a connection

&reftitle.description;

&style.oop; (constructor):

public `Stomp::__construct` `string` `broker` ini_get("stomp.default_broker_uri") `string` `username` `string` `password` `array` `headers`

&style.procedural;:

`resource` `stomp_connect` `string` `broker` ini_get("stomp.default_broker_uri") `string` `username` `string` `password` `array` `headers`

Opens a connection to a stomp compliant Message Broker.

&reftitle.parameters;

`broker`

- The broker URI

`username`

- The username.

`password`

- The password.

&stomp.param.headers;
&reftitle.returnvalues; &stomp.note.transaction;
&reftitle.changelog;

&Version; | &Description;
PECL stomp 1.0.1 | The `headers` parameter was added

&reftitle.examples;

### &style.oop;

    <?php

    /* connection */
    try {
        $stomp = new Stomp('tcp://localhost:61613');
    } catch(StompException $e) {
        die('Connection failed: ' . $e->getMessage());
    }

    /* close connection */
    unset($stomp);

    ?>

### &style.procedural;

    <?php

    /* connection */
    $link = stomp_connect('ssl://localhost:61612');

    /* check connection */
    if (!$link) {
        die('Connection failed: ' . stomp_connect_error());
    }

    /* close connection */
    stomp_close($link);

    ?>