Skip to content

Instantly share code, notes, and snippets.

@Sylvain303
Last active August 29, 2015 14:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Sylvain303/e012b2a0beec0ffbb6f0 to your computer and use it in GitHub Desktop.
Save Sylvain303/e012b2a0beec0ffbb6f0 to your computer and use it in GitHub Desktop.
mailman get number of subscribers from the web interface (without shell access)
<?php
include('liste_conf.php');
/*
$adminpw = 'secret';
$LIST_URL = 'https://mailman.server.url/cgi-bin/mailman/';
*/
if(count($_GET) > 1)
{
$list = $_GET['l'];
}
if(count($argv) > 1)
{
$list = $argv[1];
}
$list_url = $LIST_URL . '/admin/'. $list . '/members/';
$post_param = array(
'adminpw' => $adminpw,
);
$c = curl_init();
curl_setopt($c, CURLOPT_URL, $list_url);
curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
curl_setopt($c, CURLOPT_HEADER, false);
curl_setopt($c, CURLOPT_POST,true);
curl_setopt($c, CURLOPT_POSTFIELDS, $post_param);
$output = curl_exec($c);
if($output === false)
{
trigger_error('CURL Error: '.curl_error($c),E_USER_WARNING);
exit(1);
}
curl_close($c);
preg_match('/<td COLSPAN="11" BGCOLOR="#dddddd"><center><em>[^0-9]*([0-9]+)/m', $output, $m);
echo "$m[1]\n";
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment