diff --git a/src/Drivers/VectoryLinkDriver.php b/src/Drivers/VectoryLinkDriver.php index ba0cc4b..e71acce 100644 --- a/src/Drivers/VectoryLinkDriver.php +++ b/src/Drivers/VectoryLinkDriver.php @@ -1,4 +1,5 @@ endPoint, $this->headers(), $this->payload()); + $response = HTTP::post($this->endPoint, $this->headers(), $this->payload()); return new VectoryLinkResponse($response); } - protected function payload(): array + protected function payload(): string { - return - [ - "SMSText" => $this->message, - "SMSReceiver" => $this->recipients, - "SMSSender" => $this->senderName, - 'SMSLang' => $this->lang, - 'UserName' => $this->username, - 'Password' => $this->password - ]; + return http_build_query([ + "SMSText" => $this->message, + "SMSReceiver" => $this->recipients, + "SMSSender" => $this->senderName, + 'SMSLang' => $this->lang, + 'UserName' => $this->username, + 'Password' => $this->password + ]); } protected function headers(): array { return [ - 'Content-Type' => 'text/xml; charset=utf-8', - 'Content-Length' => 0 + 'Content-Type' => 'application/x-www-form-urlencoded' ]; } } diff --git a/src/Response/VectoryLinkResponse.php b/src/Response/VectoryLinkResponse.php index c1006d0..08041d7 100644 --- a/src/Response/VectoryLinkResponse.php +++ b/src/Response/VectoryLinkResponse.php @@ -32,7 +32,7 @@ final class VectoryLinkResponse implements SMSDriverResponseInterface public function __construct(ResponseInterface $response) { $this->response = new SimpleXMLElement($response->getBody()); - $this->status = (int) current($this->response); + $this->status = (int) current(get_mangled_object_vars($this->response)); } public function success(): bool diff --git a/src/Support/ConfigRepository.php b/src/Support/ConfigRepository.php index 403db56..f4ded0e 100644 --- a/src/Support/ConfigRepository.php +++ b/src/Support/ConfigRepository.php @@ -79,7 +79,7 @@ public function offsetExists($offset): bool return $this->has($offset); } - public function offsetGet($offset) + public function offsetGet($offset): mixed { return $this->get($offset); }