Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function sendOTP($mobileNo, $otp)
- {
- if ( (substr($mobileNo,0,2) == "+32") || (substr($mobileNo,0,1) == "32") ) {
- $mobileNo = $mobileNo;
- } else {
- $mobileNo = "+32".$mobileNo;
- }
- // $url = "http://121.241.242.114:8080/bulksms/bulksms?username=Mide-expert&password=erwin12&type=0&dlr=1&destination=".$mobileNo."&source=ExpertMedia&message=" . urlencode($otp);
- // $result = file_get_contents($url);
- // if ($result){
- // return true;
- // } else {
- // return false;
- // }
- try {
- $client = new Client(['verify' => false]);
- $params['username'] = 'Mide-expert';
- $params['password'] = 'erwin12';
- $params['type'] = '0';
- $params['dlr'] = '1';
- $params['destination'] = "{$mobileNo}";
- $params['source'] = 'ExpertMedia';
- $params['message'] = "{$otp}";
- $url = 'http://121.241.242.114:8080/bulksms/bulksms';
- $response = $client->request('GET', $url, [
- 'query' => $params
- ]);
- if ($response->getStatusCode() == 200) {
- return true;
- } else {
- return false;
- }
- } catch (\Exception $exception) {
- print_r($exception->getMessage());
- //return false;
- }
- }
Add Comment
Please, Sign In to add comment