0

I am trying to integrate the textlocal sms api if i pass three at the time of load library it's not working.

Error: Too few arguments to function Textlocal::__construct(), 1 passed and at least 2 expected

I have one Setupfile.php Library as following.

<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Setupfile {

  function send($number, $message)
  {

    $ci = & get_instance();
    $data=array("username"=>'xyz',"hash"=>'abc','apiKey'=>false);
    $sender  = "xyz";
    $numbers = array($number);
    $ci->load->library('textlocal', $data); //passing paramenters

  }
}

and another Textlocal.php library as follows:

class Textlocal
{

    function __construct($username, $hash, $apiKey = false) //get into this function
    {

        $this->username = $username;
        $this->hash = $hash;
        if ($apiKey) {
            $this->apiKey = $apiKey;
        }

    }
}
TimBrownlaw
  • 5,457
  • 3
  • 24
  • 28
Bhanu Pratap
  • 144
  • 6

1 Answers1

0

Basically I passed and array in the function and try to get the as a variable. Now I have solved this as getting an array()

Bhanu Pratap
  • 144
  • 6