Search code examples
phpiosobjective-csinchsinch-verification

how Pass Application-specific custom data in SMSVerificationWithApplicationKey and retrive them in php backend?


I am IOS developer.

I am using SinchVerification for mobile verification in IOS application there is one security step. Pass custom data in sinchrequest after that sinch will call our server API (Verification Callback API) with server if he got valid response from our server then only it will send verification message this is for prevent misuse of our SMSVerificationApplicationKe.

Now I passed custom string but in PHP got following request so don't know how to get my passed string.

{"Host":"web.yourhost.test”,”Connection":"Keep-Alive","Accept-Encoding":"gzip","CF-IPCountry":"GB","X-Forwarded-For":"213.242.88.220","CF-RAY":"30cff02a4c2416d0-ARN","Content-Length":"816","X-Forwarded-Proto":"https","CF-Visitor":"{\"scheme\":\"https\"}","x-timestamp":"2016-12-06T13:03:28.2621119Z","Authorization":"application 737481a8-d133-4c71-9e9b-3a80656bbefd:p9rRHZZFutjmYOYDgBzWAYos6Mt4EXpUroUawSjOeBQ=","Content-Type":"application\/json; charset=utf-8","Cookie":"__cfduid=d5eaa6f6e99e7605ed74e0a40e50e50271481020280","CF-Connecting-IP":"213.242.88.220"}

And I am calling by,

  [SINVerification SMSVerificationWithApplicationKey:@"YOUR_KEY" phoneNumber:@"+919999999999" custom:@"stringTest"];

Solution

  • You need to read the body of the request that contains Json

    $data = json_decode(file_get_contents('php://input'), true);