不会python,不过可以帮你写一个php的。你没理解_tb_token_是怎么验证的,那个正则好像也错了。处理https的方式也不对。
<?php
$ua=$_SERVER['HTTP_USER_AGENT'];
$cookie_file = 'cookie.txt';
$username='xxxxxx@126.com';
$password='password';
$ch = curl_init('
http://www.alimama.com/member/minilogin.htm');curl_setopt($ch, CURLOPT_USERAGENT, $ua);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file);
$contents=curl_exec($ch);
curl_close($ch);
$arr=explode("<input name='_tb_token_' type='hidden' value='",$contents);
$arr1=explode("'>",$arr[1]);
$token=$arr1[0]; //不会写正则。so 拆数组。
$data['logname']=$username;
$data['originalLogpasswd']=$password;
$data['logpasswd']=md5($data['originalLogpasswd']);
$data['style']='';
$data['redirect']='';
$data['proxy']='';
$data['_tb_token_']=$token;
$post_fields=http_build_query($data);
$ch = curl_init('
https://www.alimama.com/member/minilogin_act.htm');curl_setopt($ch, CURLOPT_USERAGENT, $ua);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_fields);
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file);
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
$contents=curl_exec($ch);
curl_close($ch);//已经登上了,带上cookie即可访问登录后页面
//输出登录后的阿里妈妈首页
$ch = curl_init('
http://www.alimama.com/index.htm');curl_setopt($ch, CURLOPT_USERAGENT, $ua);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file);
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file);
$contents=curl_exec($ch);
curl_close($ch);
echo $contents;
?>