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!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

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