Adding api function

Discussion in 'Developers' Forum' started by Thaddeus, Jul 5, 2016.

  1. Thaddeus

    Thaddeus New Member

    Hi Guys, is editing the /usr/local/ispconfig/interface/lib/classes/remoting.inc.php the recommended way to add a new api function or is there a better way?
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    I would do it the way that we use for the billing module. Write your own class that extends the current remote api class, then create a new remote api endpoint file similar to this one:

    Code:
    <?php
    
    require_once '../../lib/config.inc.php';
    $conf['start_session'] = false;
    require_once '../../lib/app.inc.php';
    
    if($conf['demo_mode'] == true) $app->error('This function is disabled in demo mode.');
    
    $app->load('remoting');
    $app->load('billing_remote');
    $app->uses('remoting_lib');
    
    $server = new SoapServer(null, array('uri' => $_SERVER['REQUEST_URI']));
    $server->setClass('billing_remote');
    $server->handle();
    
    ?>
     

Share This Page