Welcome Guest, Not a member yet? Register   Sign In
Fatal error: Call to undefined method
#1

[eluser]Unknown[/eluser]
Hi,

I'm having a problem using a library to perform a call to an external API.

Here is my controller :

Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Client extends CI_Controller {
  function create_user(){
    print_r($this->router->routes);  //for testing
        $this->load->view('client');  //load view

      $this->load->library('whmcs'); // load library

       $user_data=array(
        'firstname' => 'user first name',
        'lastname' => 'user lasrname',
        'email' => '[email protected]'
        'address1' => ' test address',
        'city' => ' test city',
        'state' => ' test state',
        'postcode' => '123456',
        'country' => 'IN',
        'phonenumber' => '9876543210',
        'password2'  => md5('123456')
        );
        $this->whmcs->whmcs_add_client($user_data); // create new user

    }

Here is the function called in the library :

Code:
public function whmcs_add_client($params = array()) {
     $params['action'] = 'addclient';
     return Whmcs_base::send_request($params);
   }



The error i am getting :


Code:
( ! ) Fatal error: Call to undefined method Whmcs::whmcs_add_client() in /var/www/client/application/controllers/client.php on line 30
Call Stack
# Time Memory Function Location
1 0.0001 230936 {main}( ) ../index.php:0
2 0.0002 233088 require_once( '/var/www/client/system/core/CodeIgniter.php' ) ../index.php:202
3 0.0037 601048 call_user_func_array:{/var/www/client/system/core/CodeIgniter.php:359} ( ) ../CodeIgniter.php:359
4 0.0037 601216 Client->create_user( ) ../CodeIgniter.php:359


What am i missing exactly?

Thank you in advance for your help Smile
#2

[eluser]Unknown[/eluser]
As per the doc :

Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Someclass {

    public function __construct($params)
    {
        // Do something with $params
    }
}

?>

...fixed. sorry about this Smile




Theme © iAndrew 2016 - Forum software by © MyBB