Beispiel #1
0
 /**
  * @param OutgoingSMS|OutgoingSMS[] $messages
  *
  * @throws CommunicationException
  *
  * @return SendSMSResponse[]|SMSId[]|SendError[]
  */
 public function sendSMS($messages)
 {
     if (!is_array($messages)) {
         $messages = [$messages];
     }
     $request = $this->client->createRequest('POST', 'sms/send', ['json' => Out::attachAuth($this->account, Out::SMSArrayToSendRequestBody($messages))]);
     $response = Out::send($this->client, $request);
     return Parser::prepareSendResponse($response);
 }
Beispiel #2
0
 /**
  * @param OutgoingSMS|OutgoingSMS[] $messages
  *
  * @throws CommunicationException
  *
  * @return SendSMSResponse[]|SMSId[]|SendError[]
  */
 public function sendSMS($messages)
 {
     if (!is_array($messages)) {
         $messages = [$messages];
     }
     $options = Out::attachAuth($this->account, Out::SMSArrayToSendRequestBody($messages));
     if ($this->clientVersion == '5') {
         $request = $this->client->createRequest('POST', 'sms/send', ['json' => $options]);
         $response = Out::send($this->client, $request);
     } else {
         $request = new Request('POST', 'sms/send');
         $response = Out::send($this->client, $request, ['query' => $options]);
     }
     return Parser::prepareSendResponse($response);
 }