dotcomma

Registered
Sep 25, 2011
1
0
51
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 = "asdf.com";
$account = "asdf";
$account_pw = "abc123";

$xmlapi = new xmlapi($ip);
$xmlapi->set_port(2083);
$xmlapi->password_auth($account, $account_pw);
$xmlapi->set_output('xml');
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", "asdf.com") );
}

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

Thanks