Zimbra offers Open Source email server software and shared calendar for Linux and the Mac
Go Back   Zimbra :: Forums > Zimbra Collaboration Suite > Developers

Welcome to the Zimbra :: Forums!
Welcome, if you would like to post a comment please register. We also encourage you to explore all things Zimbra with our team and members of the community.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-29-2008, 01:35 PM
Project Contributor
 
Posts: 10
Default [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
Reply With Quote
  #2 (permalink)  
Old 02-29-2008, 03:24 PM
Project Contributor
 
Posts: 10
Default 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);
    }

?>
Reply With Quote
  #3 (permalink)  
Old 03-06-2008, 08:27 AM
Project Contributor
 
Posts: 34
Default

Thanks for making this code available. I plan to make a lot of use of this on my Joomla/Zimbra integration project.
Richard - All Our EMail - Home
__________________
----------------------------------------------
Having signatures is a sign of having signatures.
Reply With Quote
  #4 (permalink)  
Old 03-10-2008, 12:25 AM
Member
 
Posts: 14
Default

great job bro
Reply With Quote
  #5 (permalink)  
Old 03-10-2008, 03:39 AM
Starter Member
 
Posts: 1
Default 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)
Reply With Quote
  #6 (permalink)  
Old 03-11-2008, 09:45 AM
Active Member
 
Posts: 41
Default

do you have a quick example of which parameters you would pass in the URL to call those sample pages ?
__________________
Derek Buchanan
Director

Utilis Technology Ltd.
http://www.utilis.ie
Reply With Quote
  #7 (permalink)  
Old 03-12-2008, 06:29 AM
Project Contributor
 
Posts: 34
Default

Ron, I have implemented a small Zimbra Status page on my site for registered users (All Our EMail - Home).
Do you have any objection to me hosting a download of your code that I can include with my Joomla code?
Thanks, Richard
__________________
----------------------------------------------
Having signatures is a sign of having signatures.
Reply With Quote
  #8 (permalink)  
Old 09-20-2008, 04:40 AM
Active Member
 
Posts: 41
Default

I've been trying to use this code class but I can't even get as far as authenticating. It returns error saying cannot connect to host.

I've tried server name as ip address and fqdn, I've tried username email with and without domain , i.e admin and admin@mydomain.com

Is there any option that needs to be enabled on the zimbra server to accept admin soap requests from a remote client. I assume not .

Any ideas ? the client server has php4 and curl which I use for other applications without issue.
__________________
Derek Buchanan
Director

Utilis Technology Ltd.
http://www.utilis.ie
Reply With Quote
  #9 (permalink)  
Old 09-20-2008, 05:29 AM
Project Contributor
 
Posts: 10
Default 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
Reply With Quote
  #10 (permalink)  
Old 09-20-2008, 09:15 AM
Active Member
 
Posts: 41
Default

telnet mailserver 7071 doesn't connect. how does telnet deal with SSL, as port 7071 traffic is encrypted

the "phpinfo" shows the php curl option being enabled.

CURL support enabled
CURL Information libcurl/7.15.3 OpenSSL/0.9.7a zlib/1.2.3

I can curl http requests to other non-zimbra servers. theres no firewall blocking port 7071 and I can access the zimbra admin console via web browser on https://www.mydomain.com:7071 from any client without problem.

if your sure there's no other configuration requirements I'll retry the options again.

thanks,
derek.
__________________
Derek Buchanan
Director

Utilis Technology Ltd.
http://www.utilis.ie

Last edited by DEREKB; 09-20-2008 at 09:24 AM..
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads

Why Join?

Registering let's you ask questions, makes it easier to search, displays any files attached to posts, and notifies you about replies.

blog.zimbra.com




 

SEO by vBSEO ©2011, Crawlability, Inc.