/** * Send request to IMASYS Messaging Platform * * @param RequestInterface $request * @throws \Exception */ public function send(RequestInterface $request) { $url = $request->buildUrl($this->credentials, $this->portalServers->getPortalServer(), 443); $body = $request->buildBody(); $curlRequest = new CurlRequest($url); $curlRequest->setPostBody(urlencode($body)); $curlRequest->run(); if (!$curlRequest->wasSuccessful()) { throw new \Exception(); } $curlResponse = $curlRequest->response; return $request->parseResponse($curlResponse); }