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!

Passing $xmlapi to function?

Discussion in 'cPanel Developers' started by dotcomma, Sep 25, 2011.

  1. dotcomma

    dotcomma Registered

    Sep 25, 2011
    Likes Received:
    Trophy Points:
    cPanel Access Level:
    Website Owner
    Hi all, this is newbie, but and just a PHP question more than anything.. so.. here goes
    in PHP, how can I pass the $xmlapi object to functions?

    function initxmlapi(){
    $ip = "";
    $account = "asdf";
    $account_pw = "abc123";

    $xmlapi = new xmlapi($ip);
    $xmlapi->password_auth($account, $account_pw);
    return $xmlapi;
    how can i return the xmlapi object? can i do this? should i even do this?

    i want to then pass this to a function by:

    $xmlapi = initxmlapi();

    function createEmailAccount($xmlapi){
    // all the variables declared here
    $xmlapi->api1_query( $account, "Email", "addpop", array("blabla", "blabla", "1", "") );

    this works when i don't put them in functions.. but when I do separate them out, it doesn't work. any advice?


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