[SOLVED] PHP Class for easy access to Zimbra SOAP API
Greetings:
I am writing a PHP class for accessing the Zimbra SOAP API. While not complete yet, it does have most of the important functions working. Current functions include multiple account and domain manipulation functions.
If you would like to check this out, it may be downloaded from ftp://ftp.rongage.org/pub/zimbraAdmin
If anyone has any questions, please don't hesitate to ask!
Ron Gage
Example of how easy this class is to use
Just so you can see how easy this class is to implement, here is the example code to retrieve a list of email address for a domain from a zimbra server...
Code:
<?php
include ("zimbraAdmin.php");
include ("zimbraAdmin.config");
$zim = new zimbraAdmin($zimbraserver);
if ($zim->zimbra_login($zimbraadminemail,$zimbraadminpassword) == false)
{
echo ("Could not authenticate to the Zimbra server\n");
exit(-1);
}
if ($argc != 2)
{
echo ($argv[0] . " [domain name to retrieve]\n\n");
echo ("Get the current email addresses for the domain you request.\n\n");
exit(-1);
}
$addr = $argv[1];
echo ("Email addresses: $addr\n");
$ret = $zim->zimbra_get_all_accounts($addr);
if (isset ($ret['ACCOUNT']['NAME']))
{
$name = $ret['ACCOUNT']['NAME'];
$status = "active";
if ($zim->zimbra_is_account_locked($name) == true)
$status = "locked";
printf ("%s - %s\n",$name, $status);
}
else
foreach ($ret['ACCOUNT'] as $a)
{
$name = $a['NAME'];
$status = "active";
if ($zim->zimbra_is_account_locked($name) == true)
$status = "locked";
printf ("%s - %s\n",$name, $status);
}
?>
function zimbra_search_directory_request
could you explain how i have to write a query in the function zimbra_search_directory_request .
In the doc i see the query string should be an LDAP-style filter string (RFC 2254)
troubleshooting connectivity
But is PHP configured to use CURL directly?
from a command line: php -i | grep -i curl
from a web page: <?php phpinfo(); ?>
The other thing to check: is there anything like a firewall blocking TCP/7071 between the 2 machines in question? From the web machine, try: telnet mail_server 7071 - does this connect?
Ron