PHP Example of API Login

Have a great idea for extending Zimbra? Share ideas, ask questions, contribute, and get feedback.
Post Reply
codeorodeo
Posts: 3
Joined: Tue Aug 16, 2016 3:41 pm

PHP Example of API Login

Post by codeorodeo »

Hi,

This board won't allow search terms to be used like api, php, example-- considered too broad. I've looked all over (here, and via Google, not just direct API, but Zimlets as well) trying to find one useful example of 'Hello World' where someone simply connects to the Zimbra SOAP API using PHP, and I haven't found any. You'd think that this sort of 101 documentation would be the first example provided by the Zimbra folks for every language that might use it.

I'm not an Admin, I just want to access my own inbox messages using the API, and perform a task in PHP based on the contents of some of my messages.

Any example would be gratefully appreciated. I'm comfortable with cURL, JSON, XML... but I have some mental block on how to put this initial step together.
phoenix
Ambassador
Ambassador
Posts: 27278
Joined: Fri Sep 12, 2014 9:56 pm
Location: Liverpool, England

Re: PHP Example of API Login

Post by phoenix »

Regards

Bill

Rspamd: A high performance spamassassin replacement

Per ardua ad astra
codeorodeo
Posts: 3
Joined: Tue Aug 16, 2016 3:41 pm

Re: PHP Example of API Login

Post by codeorodeo »

phoenix wrote:Are these links of any use? https://www.google.fr/search?q=site:zim ... gAaM65eoBg
Thanks, already looked at those. Most of those are someone else asking question and having problems, or are Administrative (whereas I'm a user) or don't show the credential process. I've built APIs, worked with JSON, XML, and SOAP. I'm trying to avoid the trap of JSON and XML because they represent the lowest common denominator of performance (they throw an enormous amount of 'wrapper' text back and forth). My understanding is that Zimbra doesn't actually use SOAP, but rather XML over HTTP, but okay, fine.

I just need to see an actual example of logging in. The 'reference' manuals are just that-- reference for the methods/calls, but again-- no 101 'Hello World' example.
phoenix
Ambassador
Ambassador
Posts: 27278
Joined: Fri Sep 12, 2014 9:56 pm
Location: Liverpool, England

Re: PHP Example of API Login

Post by phoenix »

I wasn't really sure if you had seem those or even if they were of any use. Unfortunately you're talking gobbledegook to me as I'm not a developer, hopefully there will be someone along who can give you more help with your question.
Regards

Bill

Rspamd: A high performance spamassassin replacement

Per ardua ad astra
liverpoolfcfan
Elite member
Elite member
Posts: 1112
Joined: Sat Sep 13, 2014 12:47 am

Re: PHP Example of API Login

Post by liverpoolfcfan »

You could check out the z-push zimbra backend to see if that has what you need in terms of figuring out how to connect. https://sourceforge.net/projects/zimbrabackend/ You can download just the zimbra.php file from the z-push-2 branch of the code repository or just download the latest zimbra64.tgz

Look in the Logon function. There is a lot of stuff in there you won't need but if you have coded in php you should be able to pick out the stuff you do need. Pay particular attention to the need to issue a NoOpRequest after the AuthRequest if a session ID was not returned. This happens if the NGINX proxy is in place.

I hope that helps
thorx
Advanced member
Advanced member
Posts: 54
Joined: Sat Sep 13, 2014 3:26 am

Re: PHP Example of API Login

Post by thorx »

Havent tried using soap through php yet, but successfully used it through python and powershell.

Have you looked at the php-wrappers that are out there? I see there are some at github. No idea if they are good or not.:
https://github.com/zimbra-api/zimbra-api
codeorodeo
Posts: 3
Joined: Tue Aug 16, 2016 3:41 pm

Re: PHP Example of API Login

Post by codeorodeo »

Thanks guys for both the links (back end and api wrappers), I'm looking at that now. I had tried looking in that direction previously, but wasn't able to find the specific file I needed, so was obviously in the wrong area. I'll post back with progress once I have more.
Post Reply