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

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 Display Modes
  #1 (permalink)  
Old 06-11-2009, 05:47 AM
Member
 
Posts: 13
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,
Reply With Quote
  #2 (permalink)  
Old 06-11-2009, 05:52 AM
Member
 
Posts: 13
Default

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

Cheers,
Reply With Quote
  #3 (permalink)  
Old 06-12-2009, 11:40 AM
Member
 
Posts: 11
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 {
...
}
Reply With Quote
  #4 (permalink)  
Old 06-15-2009, 07:44 AM
Member
 
Posts: 13
Default

That's very helpful now I can see how the the integration works clearer, thanks scotty!!!
Reply With Quote
  #5 (permalink)  
Old 06-29-2009, 07:30 AM
Member
 
Posts: 12
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.
Reply With Quote
  #6 (permalink)  
Old 06-30-2009, 03:27 PM
Zimlet Guru & Moderator
 
Posts: 430
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.
Reply With Quote
  #7 (permalink)  
Old 07-01-2009, 12:42 AM
Member
 
Posts: 12
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.
Reply With Quote
  #8 (permalink)  
Old 07-01-2009, 04:42 AM
Zimlet Guru & Moderator
 
Posts: 196
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.
Reply With Quote
  #9 (permalink)  
Old 07-01-2009, 04:52 AM
Member
 
Posts: 12
Default

Thanx dear,

Problem solved now I know what the problem
Reply With Quote
  #10 (permalink)  
Old 07-12-2009, 11:18 AM
Junior Member
 
Posts: 8
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.
Reply With Quote
Reply


Thread Tools
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.

Zimbrablog.com




 

Search Engine Optimization by vBSEO 3.1.0