[Mailman-Developers] PHP Wrappers?
jag at fsf.org
Thu Nov 17 18:46:43 CET 2005
Well, it's pretty much about as vanilla of an XMLRPC interface as we
could generate... I'm not a PHP programmer, so I don't know exactly how
the XMLRPC bindings work on PHP, but the Readers' Digest version of
XMLRPC goes like this...
XMLRPC is a request-response based remote procedure call mechanism over
HTTP. The client initiates a request to the XMLRPC "listener" and posts
an XML document that represents a request. For example, let's say I wrap
the function multiply(x, y) which multiplies two numbers together.
First, I need to give the function an XMLRPC methodname, so we'll call
it "foo.multiply". A request might look like:
which the "listener" would parse and dispatch to multiply(x, y) and get
back 10. Which it would then send as a response to the client.
and so your XMLRPC client would return 10.
There are a handful of standard "system" methods, so for example you can
execute system.listMethods() to see what methods are implemented; or
system.methodHelp(methodName) to see documentation on a method. Also, if
errors occur, they are raised as "faults" with a fault code and a fault
Fortunately most programming languages wrap the details of all of this
up for you to make it easy. In Python, you instantiate an object that
represents a connection to an XMLRPC listener. Then all methods
implemented by that listener become attributes of that object. So in
>>> import xmlrpclib
>>> sp = xmlrpclib.ServerProxy('http://lists.mysite.com/mailman/RPC2')
'Mailman.createList', 'Mailman.deleteList', 'Mailman.deleteMember',
'Mailman.getDigestMembers', 'Mailman.getMembers', 'Mailman.getOptions',
'Mailman.setOptions', 'system.listMethods', 'system.methodHelp',
So these are the methods exported by the Mailman RPC listener. So how do
>>> print sp.system.methodHelp('Mailman.addMember')
"add_member(listname, admin_pw, address, fullname, password, digest, now):
Subscribes the email address provided to the mailing list.
listname -- the name of the list to configure
admin_pw -- the list or site administrator password
address -- the email address to add
fullname -- the user's full name
password -- the password the user would like to have, leave blank to
generate a random password
digest -- True or False implying if they wish to receive batched digest
now -- True or False implying whether to bypass normal mailing list rules
Returns True if everything succeeded; raises Fault -32501 if the user needs
to confirm their subscription; raises Fault -32502 if the list administrator
needs to approve their subscription"
So I could execute Mailman.addMember('whatifnet-announce', 'f00bar',
'jag at fsf.org', 'jagpass', False, True) to add myself to the list
whatifnet-announce with regular delivery and without having to confirm
my email address. The method would return True if everything succeeded.
In Python, I'd do:
>>> sp.Mailman.addMember('whatifnet-announce', 'f00bar', 'jag at fsf.org',
'jagpass', False, True)
There are some pretty good references for how PHP's XMLRPC client works,
so I'd refer to those to figure out how to write a PHP client for this
Does that answer your questions somewhat?
On Thu, 2005-11-17 at 09:55 -0500, Adrian Wells wrote:
> Thank you for the reply. I had briefly looked over this XMLRPC patch
> before posting to the mailing list, but I do not understand how it
> would provide the desired functionality. However, having received
> your message, I want to learn more and understand how this might
> work. Do you have some examples, documentation, or other resources
> that I might be able to review to learn more?
> In the meantime, I'll look at the patch more closely to try to
> understand how it works and how to interface with it.
> Thank you,
> Joshua Ginsberg <jag at fsf.org> on Wednesday, November 16, 2005 at 3:01
> PM +0000 wrote:
> This would be something that could take advantage of the XMLRPC patch
> under review:
> See also:
> On Wed, 2005-11-16 at 13:12 -0400, Adrian Wells wrote:
> > Hello. How might one configure Mailman (version 2.1.6) list
> > using PHP scripts? The goal is to configure Mailman list settings
> such as
> > domain name of list, non-digest footer, set welcome/goodbye
> messages, etc.
> > An approach that comes to mind is to use bin/config_list. This
> > require writing/reading files and using bin/config_list to process
> > Is there another recommended or preferred way to accomplish this?
> > There was a post about "PHP Wrappers" which suggested, "...just use
> > setuid mailman wrapper script that does caller-checking to see if
> > called correctly, by the right user, and with 'safe' values"
> > This was recommended over simply adding the www user to the mailman
> > I do not completely understand how one creates a setuid mailman
> > script. Is this a matter of creating something similar to
> > If someone has written a wrapper script or has some good resources
> > explaining this to share and is willing to do so, I would appreciate
> > Thank you,
> > -Adrian
> > _______________________________________________
> > Mailman-Developers mailing list
> > Mailman-Developers at python.org
> > http://mail.python.org/mailman/listinfo/mailman-developers
> > Mailman FAQ: http://www.python.org/cgi-bin/faqw-mm.py
> > Searchable Archives: http://www.mail-archive.com/mailman-users%
> > Unsubscribe:
> > Security Policy:
> Joshua Ginsberg <jag at fsf.org>
> Free Software Foundation - Senior Systems Administrator
Joshua Ginsberg <jag at fsf.org>
Free Software Foundation - Senior Systems Administrator
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://mail.python.org/pipermail/mailman-developers/attachments/20051117/a4fafdd2/attachment.pgp
More information about the Mailman-Developers