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!

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:
    3
    Trophy Points:
    68
    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
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

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