Page 1 of 5 123 ... LastLast
Results 1 to 10 of 47

Thread: [SOLVED] PHP Class for easy access to Zimbra SOAP API

Hybrid View

  1. #1
    Join Date
    Oct 2007
    Location
    Detroit Michigan
    Posts
    10
    Rep Power
    8

    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

  2. #2
    Join Date
    Oct 2007
    Location
    Detroit Michigan
    Posts
    10
    Rep Power
    8

    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);
        }
    
    ?>

  3. #3
    Join Date
    Nov 2007
    Posts
    34
    Rep Power
    8

    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.

  4. #4
    Join Date
    Jan 2008
    Location
    jakarta indonesia
    Posts
    14
    Rep Power
    7

    Default

    great job bro

  5. #5
    Join Date
    Mar 2008
    Posts
    1
    Rep Power
    7

    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)

  6. #6
    Join Date
    Jan 2008
    Location
    Dublin
    Posts
    41
    Rep Power
    7

    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

  7. #7
    Join Date
    Jan 2008
    Location
    Dublin
    Posts
    41
    Rep Power
    7

    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

  8. #8
    Join Date
    Oct 2007
    Location
    Detroit Michigan
    Posts
    10
    Rep Power
    8

    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

  9. #9
    Join Date
    Jan 2008
    Location
    Dublin
    Posts
    41
    Rep Power
    7

    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.
    Last edited by DEREKB; 09-20-2008 at 10:24 AM.
    Derek Buchanan
    Director

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

  10. #10
    Join Date
    Oct 2008
    Posts
    38
    Rep Power
    7

    Default

    It's already complete, we started using it in our production environment some months ago.

Similar Threads

  1. Replies: 9
    Last Post: 03-01-2008, 08:21 PM
  2. Zimbra shutdowns every n hours.
    By Andrewb in forum Administrators
    Replies: 13
    Last Post: 08-14-2007, 09:55 AM
  3. Can't start Zimbra!
    By zibra in forum Administrators
    Replies: 5
    Last Post: 03-22-2007, 12:34 PM
  4. Replies: 8
    Last Post: 02-27-2007, 04:10 AM
  5. Post instsallation problems
    By Assaf in forum Installation
    Replies: 14
    Last Post: 01-29-2007, 11:38 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •