Page 2 of 5 FirstFirst 1234 ... LastLast
Results 11 to 20 of 47

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

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

    Default

    after more testing I think it might be related to a bug in the PHP libcurl version installed on my ISP's web server.
    The exact same test script works, at least gets a connection & returns an error, if I try posting a string to standard port 80.

    Theres mention of the curlopt_PORT feature not functioning correctly on older versions of libcurl (googled it ) . I'll test the php soap script from a different client server in the next few days.
    Derek Buchanan
    Director

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

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

    Default

    this is confusing. I've tried a separate hosted client server from a different ISP running PHP 4 and PHP5 . I've tried connecting to two separate zimbra servers. There are no firewalls blocking port 7071 and I can access admin console on port 7071 via web browser.

    PHP libcurl & soap are installed and enabled (details below).
    I'm still getting a curl error 7 when I try to run a PHP page which call a simple zimbra PHP soap function .

    Is there a simple PHP script anyone can give me to do a basic soap auth/logon test and return a result ?

    I'm stuck here as it should be straight forward according to the success of other users in the forum have had.

    Thanks,
    Derek

    soap
    Soap Client enabled
    Soap Server enabled

    Directive Local Value Master Value
    soap.wsdl_cache 1 1
    soap.wsdl_cache_dir /tmp /tmp
    soap.wsdl_cache_enabled 1 1
    soap.wsdl_cache_limit 5 5
    soap.wsdl_cache_ttl 86400 86400


    curl
    cURL support enabled
    cURL Information libcurl/7.12.1 OpenSSL/0.9.7a zlib/1.2.1.2 libidn/0.5.6
    Last edited by DEREKB; 09-24-2008 at 01:12 PM.
    Derek Buchanan
    Director

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

  3. #13
    Join Date
    Oct 2008
    Location
    France
    Posts
    14
    Rep Power
    7

    Default SOAP/PHP How to use zimbraadmin.php..?

    Hello,

    I really need help to user zimbraAdmin.php (http://www.zimbra.com/forums/develop...oap-api-2.html)

    the function 'zimbra_create_account' & 'zimbra_get_quota_usage' very
    intesting me, but i don't know how it works...

    i would like to create method like
    'simple_create_account($email,$domain,$password, $firstname,
    $lastname)' but i don't know the attributes to uses in the function 'zimbra_create_account' and i don't know (!) where i can seach the quota of a user... I search in the
    account properties without success.

    Can anyone help me ?

    I post my work when i finish my work, ( with debugging function etc...)

    Bests regards,

  4. #14
    Join Date
    Oct 2008
    Location
    France
    Posts
    14
    Rep Power
    7

    Wink

    Code:
    public function zimbra_create_account($email,$password,$firstname,$lastname){
    	 	$sim = new simba;
    		$zim = $sim->_zimbra_login();//extends zimbra_login
    		$sim = null;
    		//DEFINITION DES ATTRIBUTS
    		$a = array('displayName'=>$firstname.' '.$lastname,'givenName'=>$firstname,'sn'=>$lastname,'zimbraMailCanonicalAddress'=>$email);
    
    		$val = $zim->zimbra_create_account($email,$password,$a);
    		
    		if ($val != false)
    			return $val; 
    		else
    			return array(0 => ' impossible account creation ');	 
    	 }

  5. #15
    Join Date
    Feb 2009
    Posts
    14
    Rep Power
    6

    Default

    First, thank you Ron again for providing such useful scripts.

    I am trying to test the script and, like derek, I am having some trouble getting pass the authentication and connecting to the server.

    i have moved all the files (zimbraAdmin.php, zimbraAdmin.config, xmlparse.php, get_mail.php, get_account.php) into the root folder of my webserver.

    I tried to run get_email.php for testing purpose. It waits for a response and after a min or so it comes back with:

    #!/usr/bin/php Could not authenticate to the Zimbra server

    In my .config file, I have:

    $zimbraserver = "host.mydomain.com";
    $zimbraadminemail = "admin@mydomain.com";
    $zimbraadminpassword = "pwd";

    ------------------------------------------------------------

    I am able to access my admin at https://host.mydomain.com:7071/ through my browser.

    I have checked that my Zimbra server has Curl enabled:

    curl
    CURL support => enabled
    CURL Information => libcurl/7.15.5 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5

    Iptables are all disabled so there should be no firewall issue.

    Can someone shed some light on how to get the connection going? Could it be issue with my webserver side? I am using a shared hosting account for web right now.

  6. #16
    Join Date
    Oct 2008
    Location
    France
    Posts
    14
    Rep Power
    7

    Talking

    Hi,

    there is lot of bugs in the original zimbraAdmin functions.

    I make another versions without bugs @ this time.

    You can get this version here:
    http://syruis.free.fr/php/zimbraAdmin.tar.gz

    For Support and help you can contact CELESTE @:
    The lab'

    In the archive you can see two folders with the older functions and a "magic" class call zimbra that can help you very well.
    Edit=> I have make a Zend bootstap to include functions in the php4 function in the php5 class. But you can use something like include "../zimbraAdmin/zimbraAdmin.php"; ....
    To change your settings use:
    Code:
    protected function _zimbra_login() {
    		global $params, $libelles;
    		$zimbraserver = $this->_getSettings($params->ZIMBRASOAP, $params->host);
    		;
    		$zimbraadminemail = $this->_getSettings($params->ZIMBRASOAP, $params->login);
    		;
    		$zimbraadminpassword = $this->_getSettings($params->ZIMBRASOAP, $params->password);
    [...]
    or directelly
    Code:
    $zim = new zimbraAdmin($zimbraserver);
    $zim->zimbra_login($zimbraadminemail, $zimbraadminpassword);
    $this->zim = $zim;
    This code use zimbra connection cache.. thanks php5 -


    Good lucks,
    Syruis
    Last edited by Syruis; 02-17-2009 at 03:08 AM. Reason: code

  7. #17
    Join Date
    Jan 2008
    Posts
    8
    Rep Power
    7

    Default Security issue

    Thanks for the script - I haven't tried using it yet, but it looks like it fits almost exactly what I need.

    I'd just like to point out that there's a somewhat large security hole in the naming of zimbraAdmin.config. In a default installation of apache (whereby php script isn't executed on files without the appropriate file extension), and most other webservers (IIS excluded - I'm fairly sure it doesn't hand out plaintext .config files), this file can be accessed directly and in plaintext by simply navigating to the file URL in a browser.

    Due to the extremely sensitive nature of the data that's held in the .config file, I think it would be a good idea to hold this data in a file with the .php extension, e.g. zimbraAdminconfig.php. This would ensure that every server will execute the script server-side and thus not make the contained data viewable via a simple GET request.

    Thanks again

  8. #18
    Join Date
    Aug 2009
    Posts
    2
    Rep Power
    6

    Default Add Virtual Host with Class

    Is there a way to add more than one virtual host with this class? I can't seem to add more than one with a domain with it.

  9. #19
    Join Date
    Oct 2008
    Location
    France
    Posts
    14
    Rep Power
    7

    Default

    this class is multi-domain. You only have to... don't specify domain...

  10. #20
    Join Date
    Aug 2009
    Posts
    2
    Rep Power
    6

    Default re:Add Virtual Host with Class

    I guess I should have posted the code I'm having problems with.

    Code:
    $domains_name = "test.com";
    $vhosts_name = "mail.test.com";
    $vhosts2_name = "webmail.test.com";
    
    
    // add vhost on zimbra server             
    
    if($zim->zimbra_modify_domain($domains_name,$a=array('zimbraVirtualHostname'=>$vhosts_name,'zimbraVirtualHostname[1]=>$vhosts2_name))==true){
            
                
            // add vhost on db->vhosts
            
            $message = "looking good so far";
            $message_class = "message_good";
    
            } else {
                
                $message = "hmmm something went wrong.";
                $message_class = "message_bad";
                
            }
    In the Zimbra Admin panel, they have the vhosts listed as zimbraVirtualHostname[0] and zimbraVirtualHostname[1] as you add them there, so I tried it with the same thinking it would add them as an array. But it didn't.

    Am I just missing the boat completely??

    Thanks so much for the reply and the help!
    Last edited by bvd; 09-10-2009 at 01:01 PM.

Similar Threads

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