Re: [Mailman-Users] Administrate list via HTML?
I need to be able to send the commands from a PHP script. There is no way that I know of to handle the login and execute commends on the HTML pages from a PHP script.
----- Original Message ----- From: "Young, Darren" <Darren.Young@gsb.uchicago.edu> To: "Sean Robertson" <webolutionary@webolutionary.com> Sent: Monday, May 03, 2004 4:53 PM Subject: RE: [Mailman-Users] Administrate list via HTML?
What about the mailman HTML interface that comes with? They have it disabled?
-----Original Message----- From: mailman-users-bounces@python.org [mailto:mailman-users-bounces@python.org] On Behalf Of Sean Robertson Sent: Monday, May 03, 2004 3:51 PM To: mailman-users@python.org Subject: [Mailman-Users] Administrate list via HTML?
I asked this question earlier, but I don't think I ever got a reply (can't seem to find it at any rate). The list I administrate is located on another server, which I do not have SSH access to. The problem, however, is that I need some way to administer the list that can be executed via a PHP script. Is there any kind of email interface to MailMan's admin functions? I can very easily generate an email with commands in it (already doing that to subscribe users), but I need access to some admin functions as well. Am I just SOL?
This is becoming a more urgent matter with each passing day, so any assistance you could provide would be _greatly_ appreciated. Thanks.
Sean Robertson webolutionary@webolutionary.com http://www.webolutionary.com http://www.tidewater4dean.com
"You have the power to take back your country!" - Howard Dean - www.deanforamerica.com
"Great is the glory, for the strife is hard." - William Wordsworth
"One of the penalties for refusing to participate in politics is that you end up being governed by your inferiors." - Plato
Mailman-Users mailing list Mailman-Users@python.org http://mail.python.org/mailman/listinfo/mailman-users Mailman FAQ: http://www.python.org/cgi-bin/faqw-mm.py Searchable Archives: http://www.mail-archive.com/mailman-users%40python.org/
Hi,
Sean Robertson wrote:
I need to be able to send the commands from a PHP script. There is no way that I know of to handle the login and execute commends on the HTML pages from a PHP script.
I you can exec GNU wget from your PHP script, then this command might be a hint.
$ wget -O /dev/null
"http://server/mailman/admin/list?adminpw=passwd&description=New+Desc"
Have fun.
-- Tokio Kikuchi, tkikuchi@ is.kochi-u.ac.jp http://weather.is.kochi-u.ac.jp/
On 3 May 2004, at 21:57, Sean Robertson wrote:
I need to be able to send the commands from a PHP script. There is no way that I know of to handle the login and execute commends on the HTML pages from a PHP script.
If you are absolutely bound and determined to use PHP for doing your list admin via the Mailman admin web GUI and the standard Mailman web GUI cannot meet your needs then you can drive the standard Mailman admin GUI by screen scraping. You could certainly do it with Python and I see no in-principle reason why you cannot do it with PHP. A quick web search threw up the CURL client support library for use with PHP which, at first glance, looks like it may be man enough for the job:
http://ca.php.net/manual/en/ref.curl.php
Mailman's web GUI uses cookie authentication and your code has to understand how to do that but it is not rocket science.
The main issue is being able to extract Set-cookie: headers from responses and add Cookie: headers to requests.
As an example, the crude Python code fragment below will login to a Mailman web GUI and extract a list's basic membership admin HTML page.
But be aware of how vulnerable your PHP code is going to be to changes in the Mailman interface, even if it is extremely well thought out. But this is true of all screen scrapers.
Python code fragment follows
import httplib import urllib # hardwired list admin password - awful security parms = urllib.urlencode({'adminpw': 'yourpassword', 'admlogin': 'Let me in...'}) hdrs = {"Content-type": "application/x-www-form-urlencoded", "Accept": "text/html"} conn = httplib.HTTPConnection('server.yourdomain.com:80') # This request should 'log us in' and get Mailman to return the authentication # cookie with the list's general options page conn.request('POST', '/mailman/admin/listname', parms, hdrs) resp = conn.getresponse() print resp.status, resp.reason # should be 200 and OK data = resp.read() # data now contains the HTML of the list's General options page conn.close() # Get the cookie set by Mailman scookie = resp.getheader('set-cookie') # Extract the cookie value to return with next request cookie = scookie.split(';')[0].strip() nhdrs = {"Accept": "text/html", 'Cookie': cookie} conn = httplib.HTTPConnection('server.yourdomain.com:80') # Now get the Membership list page for the list conn.request('GET', '/mailman/admin/listname/members', None, nhdrs) resp = conn.getresponse() print resp.status, resp.reason # should be 200 and OK data = resp.read() # data now contains the HTML of the list's Membership List page conn.close() ... and so on ...
participants (3)
-
Richard Barrett
-
Sean Robertson
-
Tokio Kikuchi