The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Api1 Help: SubDomain::setsuburl() not working properly

Discussion in 'cPanel Developers' started by rcalise, Oct 18, 2012.

  1. rcalise

    rcalise Registered

    Joined:
    Oct 18, 2012
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    I'm using the cPanel XMLAPI PHP script. In this case, I'm managing subdomains - creating, deleting, and (attempting) redirecting.

    I cannot seem to get SubDomain::setsuburl() to function as documented (SubDomain::setsuburl) I've tried all of the following scenarios:

    PHP:
    $query = array('sub' => 'sub''url' => 'http://www.example.com/');
    $rdr $xmlapi->api1_query($cpuser'SubDomain''setsuburl'$query);
    PHP:
    $query = array('sub' => 'sub.domain.com''url' => 'http://www.example.com/');
    $rdr $xmlapi->api1_query($cpuser'SubDomain''setsuburl', array($query));
    PHP:
    $query = array('sub' => 'sub.domain.com''url' => 'http://www.example.com/');
    $rdr $xmlapi->api1_query($cpuser'SubDomain''setsuburl', array($query));
    No matter what I try, the response I see when I var_dump($rdr) is always the same:

    Code:
    object(SimpleXMLElement)#5 (7) { 
      ["module"]=> string(9) "SubDomain" 
      ["func"]=> string(9) "setsuburl" 
      ["type"]=> string(5) "event" 
      ["source"]=> string(8) "internal" 
      ["apiversion"]=> string(1) "1" 
      ["data"]=> object(SimpleXMLElement)#6 (1) { 
        ["result"]=> string(68) "nowhere (Redirection Disabled!) " 
      } 
      ["event"]=> object(SimpleXMLElement)#3 (1) { 
        ["result"]=> string(1) "1" 
      } 
    }
    Has anyone ever encountered this? Any ideas how to fix it? Am I completely missing something here?
     
  2. cPanelDavidN

    cPanelDavidN Integration Developer
    Staff Member

    Joined:
    Dec 17, 2009
    Messages:
    571
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    Hi rcalise,

    The following example worked for me.

    PHP:
    $cp = new xmlapi($ip$auth_user$auth_passwd');

    // Uncomment for debugging
    // $cp->set_debug(1);

    $cpuser = '
    adave';
    $mod = '
    SubDomain';
    $func = '
    setsuburl';

    /**
     * API 1 takes arguments as an ordered list, aka ordinal array…not an associative array
     *  Ordering is the same as presented in the API documentation (though the args are '
    named' there)
     */
    $args = array(
        '
    testsub.adave.net',
        '
    http://example.com',
    );

    $result $cp->api1_query($cpuser$mod$func$args);
    Regards,
    -DavidN
     
Loading...

Share This Page