Page 1 of 2 12 LastLast
Results 1 to 10 of 13

Thread: Zimlet with PHP API??

  1. #1
    xrickung is offline Member
    Join Date
    Jan 2009
    Posts
    13
    Rep Power
    6

    Question Zimlet with PHP API??

    Wondering if it is possible to write a zimlet with PHP API?
    And if yes can you please guide me a little bit.

    Thank you,

  2. #2
    xrickung is offline Member
    Join Date
    Jan 2009
    Posts
    13
    Rep Power
    6

    Default

    Sorry
    I mean to integrate zimbra to an external apllication that provides PHP API (with zimlet).

    Cheers,

  3. #3
    scotty is offline Intermediate Member
    Join Date
    Mar 2008
    Location
    Stanford, CA
    Posts
    15
    Rep Power
    7

    Default

    You'd need to write a shim to the PHP API, like a REST or SOAP web service, or just a basic web page, then access that interface from your Zimlet via the Zimbra Proxy.

    Code:
    // call the web service to retrieve ABC
    var service_url = 'http://....' + '?what=ABC';
    var url = ZmZimletBase.PROXY + AjxStringUtil.urlComponentEncode(service_url);
    
    AjxRpc.invoke(null, url, null, new AjxCallback(this, this._handler), true);
    Your PHP would look like:

    Code:
    <?php
    require 'API';
    
    $what = $_REQUEST['what'];
    if (valid_what($what)) {
      $resp = API_call($what);
      echo what_to_html($resp);
    } else {
    ...
    }

  4. #4
    xrickung is offline Member
    Join Date
    Jan 2009
    Posts
    13
    Rep Power
    6

    Default

    That's very helpful now I can see how the the integration works clearer, thanks scotty!!!

  5. #5
    Join Date
    Jun 2009
    Location
    India
    Posts
    12
    Rep Power
    6

    Default

    Quote Originally Posted by scotty View Post
    You'd need to write a shim to the PHP API, like a REST or SOAP web service, or just a basic web page, then access that interface from your Zimlet via the Zimbra Proxy.

    Code:
    // call the web service to retrieve ABC
    var service_url = 'http://....' + '?what=ABC';
    var url = ZmZimletBase.PROXY + AjxStringUtil.urlComponentEncode(service_url);
    
    AjxRpc.invoke(null, url, null, new AjxCallback(this, this._handler), true);
    Your PHP would look like:

    Code:
    <?php
    require 'API';
    
    $what = $_REQUEST['what'];
    if (valid_what($what)) {
      $resp = API_call($what);
      echo what_to_html($resp);
    } else {
    ...
    }
    I got 403 forbidden error while passing my local url.

    I am passing 'http://localhost/test.php?action=test'. Its give me 403 forbidden error in response.

    so my url is look like "/service/proxy?target=http%3A%2F%2Flocalhost%2Ftest.php"

    Can you please suggest where I am wrong.

  6. #6
    JoshuaPrismon is offline Zimlet Guru & Moderator
    Join Date
    Nov 2005
    Posts
    477
    Rep Power
    9

    Default

    Quote Originally Posted by ashish_clarion View Post
    I got 403 forbidden error while passing my local url.

    I am passing 'http://localhost/test.php?action=test'. Its give me 403 forbidden error in response.

    so my url is look like "/service/proxy?target=http%3A%2F%2Flocalhost%2Ftest.php"

    Can you please suggest where I am wrong.
    Check your zimlet xml file, and make sure you have given it permission to access outside resources.

  7. #7
    Join Date
    Jun 2009
    Location
    India
    Posts
    12
    Rep Power
    6

    Default

    Yes, I have made allowedDomains "*" in config_template.xml but still I am not able to request on that.
    I am developing zimlet in Zimbra Desktop under _dev dir.

  8. #8
    tdesorbaix is offline Zimlet Guru & Moderator
    Join Date
    Apr 2007
    Location
    Paris, France
    Posts
    367
    Rep Power
    8

    Lightbulb

    Quote Originally Posted by ashish_clarion View Post
    I am developing zimlet in Zimbra Desktop under _dev dir.
    That is the problem.
    The allowedDomains in the config_template.xml is set when you deploy the zimlet.

    Just deploy the zimlet once or add the allowedDomains with the CLI.

  9. #9
    Join Date
    Jun 2009
    Location
    India
    Posts
    12
    Rep Power
    6

    Default

    Thanx dear,

    Problem solved now I know what the problem

  10. #10
    ronanhigg is offline Member
    Join Date
    Jul 2009
    Posts
    10
    Rep Power
    6

    Default

    Quote Originally Posted by tdesorbaix View Post
    That is the problem.
    The allowedDomains in the config_template.xml is set when you deploy the zimlet.

    Just deploy the zimlet once or add the allowedDomains with the CLI.
    Can you elaborate on this? CLI?

    I've got several of the Zimbra Gallery Zimlets in my Zimbra Desktop _dev folder. They load, but when I right-click on the panelLabel to get a menu, the menu buttons do not work.

    Tested on Firefox 3.5 and IE 8 on Windows XP Professional SP3.

Page 1 of 2 12 LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 21
    Last Post: 02-04-2010, 10:06 AM
  2. Outlook 2007 Beta error
    By bersrker in forum Zimbra Connector for Outlook
    Replies: 13
    Last Post: 07-17-2008, 07:38 AM
  3. [SOLVED] Install Problem in Ubuntu 6.06 Server
    By xtimox in forum Installation
    Replies: 16
    Last Post: 03-27-2008, 09:36 AM
  4. Replies: 5
    Last Post: 01-11-2008, 05:34 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
  •