smsgatewayme / client-php

PHP Client for smsgateway.me
26 stars 32 forks source link

Invalid input exception?? #6

Closed muhammad-ihsan closed 6 years ago

muhammad-ihsan commented 6 years ago

I tried with postman your api is working well, but if i tried with PHP scripts return: {"status":"fail","message":"Could not process request","data":{"exception":"Invalid input"}}

sepehrs commented 6 years ago

Hi can you please share your code and i'll see if i can spot why its returning an error

muhammad-ihsan commented 6 years ago

Generate by postman

<?php

$request = new HttpRequest();
$request->setUrl('https://smsgateway.me/api/v4/message/send');
$request->setMethod(HTTP_METH_POST);

$request->setHeaders(array(
  'postman-token' => '16f01a40-21ac-8e4c-660c-ed37ec04c45e',
  'cache-control' => 'no-cache',
  'content-type' => 'application/json',
  'authorization' => 'my-key'
));

$request->setBody('[
  {
    "phone_number": "08962204xxxx",
    "message": "Hello Worldzzzz",
    "device_id": 72171
  }
]');

try {
  $response = $request->send();

  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}
muhammad-ihsan commented 6 years ago

With shell script:

ihsan@zeus:~$ curl --request POST \
>   --url https://smsgateway.me/api/v4/message/send \
>   --header 'authorization: my-key' \
>   --header 'cache-control: no-cache' \
>   --header 'content-type: application/json' \
>   --header 'postman-token: a20e0853-01ef-35c4-e4b6-3175e2c456cc' \
>   --data '[\n  {\n    "phone_number": "08962204xxxx",\n    "message": "Hello Worldzzzz",\n    "device_id": 72171\n  }\n]'

return {"status":"fail","message":"Could not process request","data":{"exception":"Invalid input"}}

muhammadyounispk commented 6 years ago

I have same error

ulzii-dev commented 5 years ago

Same error. Is it resolved?

muhammad-ihsan commented 5 years ago

@PanwarInformationTechnology @Saruul-Ulzii i dont know if this package is still maintained. I just downgrade the version of smsgateway.me client

muhammad-ihsan commented 5 years ago

and no longer use this package soon