コード例 #1
0
 /**
  * @param ShortMessageInterface $message
  * @return boolean
  *
  * @throws DeliveryFailedException
  */
 public function send(ShortMessageInterface $message)
 {
     $webSmsMessage = new WebSmsMessage($message->getRecipient(), $message->getBody());
     $result = $this->connection->send($webSmsMessage);
     if ($this->logger) {
         $this->logger->info('WebSMS: Sending sms', ['recipient' => $message->getRecipient(), 'success' => $result]);
     }
     return $result;
 }
コード例 #2
0
 /**
  * @param $to
  * @param $body
  * @return mixed
  */
 public function sendMessage(ShortMessageInterface $message)
 {
     //Do authenticate here
     $this->authenticate();
     if ($this->accessToken != false) {
         $to = $this->formatNumber($message->getRecipient());
         $response = $this->client->post('sms/messages', ['headers' => ['Authorization' => 'Bearer ' . $this->accessToken, 'Content-Type' => 'application/json'], 'json' => ['to' => $to, 'body' => $message->getBody()]]);
         return json_decode($response->getBody());
     }
     return false;
 }
コード例 #3
0
 /**
  * @param ShortMessageInterface $message
  * @return boolean
  *
  * @throws DeliveryFailedException
  */
 public function send(ShortMessageInterface $message)
 {
     $message->setRecipient($this->recipient);
     return $this->transport->send($message);
 }
コード例 #4
0
 /**
  * @param ShortMessageInterface $message
  * @return boolean
  *
  * @throws DeliveryFailedException
  */
 public function send(ShortMessageInterface $message)
 {
     $webSmsMessage = new WebSmsMessage($message->getBody(), $message->getRecipient());
     return $this->connection->send($webSmsMessage);
 }