Results 1 to 4 of 4

Thread: [SOLVED] PHP error connection to Zimbra

  1. #1
    Join Date
    Mar 2009
    Posts
    12
    Rep Power
    6

    Angry [SOLVED] PHP error connection to Zimbra

    Hi guys, i use this part of a class to connect to zimbra, but it always report an error... i try zmsoap to check soap is working ok and it works on localhost where the server is... but when we execute this class to connect to https://domain:7071/service/admin/soap it says can't connect to sever.
    Any ideas?

    Here's the code (extract of a functionally joomla integration for zimbra) :

    class zimbraAdmin {
    public $soapheader;
    public $zimbra_error;
    public $zimbra_errno;
    public $zimbra_session;
    public $zimbra_auth;
    public $curlhandle;

    public function zimbraAdmin($server) {

    $this->curlhandle = curl_init();
    curl_setopt($this->curlhandle, CURLOPT_URL, "https://$server:7071/service/admin/soap");
    curl_setopt($this->curlhandle, CURLOPT_POST, TRUE);
    curl_setopt($this->curlhandle, CURLOPT_RETURNTRANSFER, TRUE);
    curl_setopt($this->curlhandle, CURLOPT_SSL_VERIFYPEER, TRUE);
    curl_setopt($this->curlhandle, CURLOPT_SSL_VERIFYHOST, TRUE);

    }

    public function set_zimbra_header() {
    $this->soapheader = '<soap:Envelope
    xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
    <soap:Header>
    <context xmlns="urn:zimbra"';
    if ($this->zimbra_session != 0)
    $this->soapheader .= '>
    <authToken>' . $this->zimbra_auth . '</authToken>
    <sessionId id="' . $this->zimbra_session . '">' . $this->zimbra_session . '</sessionId>
    </context>';
    else
    $this->soapheader .= '/>';
    $this->soapheader .= '
    </soap:Header>
    <soap:Body>
    ';
    }

    public function zimbra_login($adminuser, $adminpass)
    {

    $xml = new xml2Array();
    $this->set_zimbra_header();
    $soapmessage = $this->soapheader . '
    <AuthRequest xmlns="urn:zimbraAdmin">
    <name>' . $adminuser . '</name>
    <password>' . $adminpass . '</password>
    </AuthRequest>
    </soap:Body>
    </soap:Envelope>';
    curl_setopt($this->curlhandle, CURLOPT_POSTFIELDS, $soapmessage);
    if (!($zimbraSOAPResponse = curl_exec($this->curlhandle)))
    {
    $this->zimbraerrno = curl_errno($this->curlhandle);
    $this->zimbraerror = curl_error($this->curlhandle);
    return false;
    }

    $res = $xml->parse($zimbraSOAPResponse);
    if (! isset($res['SOAP:ENVELOPE']['SOAP:BODY']['AUTHRESPONSE']))
    return false;
    $x = $res['SOAP:ENVELOPE']['SOAP:BODY']['AUTHRESPONSE'];
    $this->zimbra_session = $x['SESSIONID']['DATA'];
    $this->zimbra_auth = $x['AUTHTOKEN']['DATA'];

    return true;
    }
    }

    $obj = new zimbraAdmin('192.123.321.1');
    $obj->zimbra_login('admin@domain','pass');
    print_r($obj);

    Any comments would be apreciated

  2. #2
    Join Date
    Nov 2006
    Location
    UK
    Posts
    8,017
    Rep Power
    25

    Default

    You posted in the Zimbra Desktop area so I moved it for you

  3. #3
    Join Date
    Mar 2009
    Posts
    12
    Rep Power
    6

    Default

    Thanks Uxbod.

    Ok, i solve the problem connecting via imap and managing the connection with the imap_open... in a further post i'll post the class file that i've implemented in my company so that it helps another user's who have the same initial problems.

    In the soap access class i've rewrite it to php 5.


  4. #4
    Join Date
    Jun 2009
    Posts
    93
    Rep Power
    6

    Default

    Quote Originally Posted by ajflorido View Post
    Thanks Uxbod.

    Ok, i solve the problem (..) in a further post i'll post the class file that i've implemented in my company so that it helps another user's who have the same initial problems.

    In the soap access class i've rewrite it to php 5.

    shall you please ?

    thanks !

Similar Threads

  1. Replies: 8
    Last Post: 01-12-2012, 02:20 AM
  2. [SOLVED] Moving Zimbra to a new server
    By krolen in forum Administrators
    Replies: 109
    Last Post: 02-05-2009, 11:38 AM
  3. admin consol blank after 5.0.3 upgarde
    By maumar in forum Administrators
    Replies: 6
    Last Post: 03-21-2008, 06:16 AM
  4. Replies: 12
    Last Post: 02-25-2008, 07:28 PM
  5. Zimbra shutdowns every n hours.
    By Andrewb in forum Administrators
    Replies: 13
    Last Post: 08-14-2007, 09:55 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
  •