public function send(Message $message) : void
    {
        if ($this->destination === null) {
            $destination = $message->getDestination();
            if ($destination === null) {
                throw new \Exception('Cannot send message, no destination set.');
            }
        } else {
            $destination = $this->destination;
        }
        $relayState = $message->getRelayState();

        $msgStr = $message->toSignedXML();

        Utils::getContainer()->debugMessage($msgStr, 'out');
        $msgStr = $msgStr->ownerDocument->saveXML($msgStr);

        $msgStr = base64_encode($msgStr);

        if ($message instanceof Request) {
            $msgType = 'SAMLRequest';
        } else {
            $msgType = 'SAMLResponse';
        }

        $post = [];
        $post[$msgType] = $msgStr;

        if ($relayState !== null) {
            $post['RelayState'] = $relayState;
        }

        Utils::getContainer()->postRedirect($destination, $post);
    }
public function send(Message $message) : void
    {
        if ($this->destination === null) {
            $destination = $message->getDestination();
            if ($destination === null) {
                throw new \Exception('Cannot send message, no destination set.');
            }
        } else {
            $destination = $this->destination;
        }
        $relayState = $message->getRelayState();

        $msgStr = $message->toSignedXML();

        Utils::getContainer()->debugMessage($msgStr, 'out');
        $msgStr = $msgStr->ownerDocument->saveXML($msgStr);

        $msgStr = base64_encode($msgStr);

        if ($message instanceof Request) {
            $msgType = 'SAMLRequest';
        } else {
            $msgType = 'SAMLResponse';
        }

        $post = [];
        $post[$msgType] = $msgStr;

        if ($relayState !== null) {
            $post['RelayState'] = $relayState;
        }

        Utils::getContainer()->postRedirect($destination, $post);
    }
public function send ( Message $ message ) : void { if ( $ this -> destination === null ) { $ destination = $ message -> getDestination ( ) ; if ( $ destination === null ) { throw new \ Exception ( 'Cannot send message, no destination set.' ) ; } } else { $ destination = $ this -> destination ; } $ relayState = $ message -> getRelayState ( ) ; $ msgStr = $ message -> toSignedXML ( ) ; Utils :: getContainer ( ) -> debugMessage ( $ msgStr , 'out' ) ; $ msgStr = $ msgStr -> ownerDocument -> saveXML ( $ msgStr ) ; $ msgStr = base64_encode ( $ msgStr ) ; if ( $ message instanceof Request ) { $ msgType = 'SAMLRequest' ; } else { $ msgType = 'SAMLResponse' ; } $ post = [ ] ; $ post [ $ msgType ] = $ msgStr ; if ( $ relayState !== null ) { $ post [ 'RelayState' ] = $ relayState ; } Utils :: getContainer ( ) -> postRedirect ( $ destination , $ post ) ; }
Send a SAML 2 message using the HTTP-POST binding.

Note: This function never returns.

@param \SAML2\Message $message The message we should send.
@return void
Send a SAML 2 message using the HTTP - POST binding .