title: How to send OTP in Codeigniter by using textlocal sms api?
body: <p>I have written code to send OTP in codeigniter by using textlocalapi and loading class file(textlocal.class.php) in controller using require function but whenever I enter my mobile number it is not sending any otp to that number.</p>
  
  <pre><code>&lt;?php
  defined('BASEPATH') OR exit('No direct script access allowed');
  
  require ('./textlocal.class.php');
  
  class User extends CI_Controller {
      public function __construct() {
          parent::__construct();
          $this-&gt;load-&gt;model('User_Model');
          $this-&gt;load-&gt;helper('string');
  
      }  ?&gt;
  </code></pre>
  
  <p>this my folder structure for textlocal.class.php file
   <img src="https://i.stack.imgur.com/ki2NE.jpg"/></p>
  
  <p>Below code written in model for sending otp</p>
  
  <pre><code>public function send_otp(){
          $data['otp'] = random_string('numeric',6);
          $data['otp_id'] = random_string('alnum',6);
          $this-&gt;db-&gt;insert('otp',$data);
  
          // Account details
      $apiKey = urlencode('xyz');// My API key
  
      // Message details
      $numbers = 911234567894;
      $sender = urlencode('ABCDEF');//This my six digit sender name
      $message = rawurlencode('This is your message');
  
  
  
      // Prepare data for POST request
      $data = array('apikey' =&gt; $apiKey, 'numbers' =&gt; $numbers, "sender" =&gt; $sender, "message" =&gt; $message);
  
      // Send the POST request with cURL
      $ch = curl_init('https://api.textlocal.in/send/');
      curl_setopt($ch, CURLOPT_POST, true);
      curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
      curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
      $response = curl_exec($ch);
      curl_close($ch);
  
      // Process your response here
      return $response;
  
  
      }
  </code></pre>