From f91c6badf2b98ea72ee101b262777fb0467dae33 Mon Sep 17 00:00:00 2001 From: Sai Teja <40917760+saiteja13427@users.noreply.github.com> Date: Thu, 26 Aug 2021 16:14:28 +0530 Subject: [PATCH 1/2] Corrected the heading syntax --- README.md | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 5a494a8..41d5877 100755 --- a/README.md +++ b/README.md @@ -1,11 +1,12 @@ -#SendOTP - PHP SDK +# SendOTP - PHP SDK This SDK allows you to connect to SendOTP server from your php app. To start off, follow the following guide: [![MIT Licence](https://badges.frapsoft.com/os/mit/mit.png?v=103)](https://opensource.org/licenses/mit-license.php) + [![forthebadge](http://forthebadge.com/images/badges/built-by-developers.svg)](http://forthebadge.com) -##Set-up: +## Set-up: First of all, download the sdk by composer: @@ -29,7 +30,7 @@ Once required, the last step is to initialize the SDK with your project name and That's all, your SDK is set up! You can now use any block by copying the code snippet from the marketplace. -##Usage: +## Usage: print_r($otp->send('91998153xxxx', 'MSGIND')); @@ -43,11 +44,11 @@ The printed result will be: ) -##Issues: +## Issues: As this is a pre-release version of the SDK, you may expirience bugs. Please report them in the issues section to let us know. You may use the intercom chat on https://msg91.com for support at any time. -##Licence: +## Licence: Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: From cee7fa2779eeabd843869aa364e2076064853346 Mon Sep 17 00:00:00 2001 From: Sai Teja <40917760+saiteja13427@users.noreply.github.com> Date: Thu, 26 Aug 2021 16:30:49 +0530 Subject: [PATCH 2/2] Solving Issue #6 Made changes to solve Issue #6 --- src/sendotp/sendotp.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/sendotp/sendotp.php b/src/sendotp/sendotp.php index 39b7c23..34fabf1 100755 --- a/src/sendotp/sendotp.php +++ b/src/sendotp/sendotp.php @@ -50,12 +50,13 @@ public function send($contactNumber, $senderId, $otp=null) { $requestArgs["otp"]=$otp; $this->message=$requestArgs["message"]; $response = $this->call("sendotp.php", $requestArgs); - if($response["type"]=="success"){ - $response["otp"]=$requestArgs["otp"]; - } - else{ - $response["otp"]=""; - } + if (array_key_exists("type",$response)){ + if($response["type"]=="success"){ + $response["otp"]=$requestArgs["otp"]; + } + }else{ + $response["otp"]=""; + } return $response; }