Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

cPanel API - PHP Class vs. Email Responder

Discussion in 'cPanel Developers' started by Jack.Straw, Sep 2, 2010.

  1. Jack.Straw

    Jack.Straw Member

    Nov 30, 2006
    Likes Received:
    Trophy Points:
    Hello. I am trying to develop a simple page to allow users to create, edit, & remove autoresponders. I'm using the PHP class located here:

    cPanel PHP API | Download cPanel PHP API software for free at

    I am able to remove responders without a problem. However, attempting to add a responder results in the error message:

    Call to a member function getData() on a non-object. (line 587)

    Inspecting the PHP class i see this:
    $response = $this->HTTP->getData('mail/doaddars.html', array(
    'email'   => $email,
    'domain'  => $domain,
    'from'    => $from,
    'subject' => $subject,
    'html'    => (bool)$html,
    'body'    => $body,
    'charset' => $charset));
    I see the file "mail/doaddars.html" which i'm guessing is the problem, since i have no such file. I even checked the mail folder in the root directory. Can anyone tell me what i'm doing wrong? Unfortunately the php class has no documentation other than the comments in the class itself, which are not helpful in this case.

    Thanks in advance for any advice you can offer,
  2. cPanelDavidN

    cPanelDavidN Integration Developer

    Dec 17, 2009
    Likes Received:
    Trophy Points:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    Hi Scott,

    I've never used Atska's "cpanelphpapi", so I can't really speak to it other than the usage you've posted shows that it doesn't use or APIs but instead just submits data to an html page. That can work alot of the time, and sometimes might be the only way, but it isn't the preferred way to integrate with cPanel.

    We recommend using API1, API2 and the XML-API APIs. For PHP folk, leveraging these APIs is super simple with our XML-API PHP client class
    There are examples in that tarball that should get you pointed in the right direction as far as using it. Plus, there's tons of threads in the forum, include a big sticky thread (the first post, I think, in the Developer Discussion section).

    In particular, you'll probably to want to use the following calls; these links point to their documentation, so you know what arguments you'll need to pass:
    API1: addautoresponder - adds responder
    API1: delautoresponder - removes responder
    API2: fetchautoresponder - gets all the detail for a responser
    API2: listautoresponders - simple list of all responders

    Give me a holler if you need more specifics on the XML-API PHP client class or how to envoke those API calls using it.

    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. Jack.Straw

    Jack.Straw Member

    Nov 30, 2006
    Likes Received:
    Trophy Points:
    David, thanks a bunch! I'll give that a shot

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice