1.http://www.renren.com/Login.do<br>it is ok,my code:<br>import cookielib, urllib2, urllib<br>
cj = cookielib.CookieJar()<br>
opener =
urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))<br>
exheaders = [("User-Agent","Mozilla/4.0 (compatible; MSIE 7.1;
Windows NT 5.1; SV1)"),]<br>
opener.addheaders=exheaders<br>
url_login = 'http://www.renren.com/Login.do'<br>
body = (('email',' '),
('password', '))<br><div id="sina_keyword_ad_area2" class="articalContent ">
req1 = opener.open(url_login, urllib.urlencode(body))<br>
file=open('/tmp/sample','w')<br>
file.write(req1.read())<br>
file.close()<br><br>2.https://passport.baidu.com/?login<br>can't login,my code:<br>import cookielib, urllib2, urllib<br>
cj = cookielib.CookieJar()<br>
opener =
urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))<br>
exheaders = [("User-Agent","Mozilla/4.0 (compatible; MSIE 7.1;
Windows NT 5.1; SV1)"),]<br>
opener.addheaders=exheaders<br>
url_login = 'https://passport.baidu.com/?login'<br>
body =(('username',' '), ('password',' '),('pwd','1'))<br>
<div id="sina_keyword_ad_area2" class="articalContent ">
req1 = opener.open(url_login, urllib.urlencode(body))<br>
file=open('/tmp/sample','w')<br>
file.write(req1.read())<br>
file.close()</div>what i get is:<br><!--STATUS OK-->
<br><html><head><title>������§�������� </title>
<br><meta http-equiv=content-type content="text/html; charset=gb2312">
<br><META http-equiv='Pragma' content='no-cache'>
<br></head>
<br><body>
<br> <br> <br> <br> <script>
<br> var url="./?pwd=1"
<br> url=url.replace(/^\.\//gi,"http://passport.baidu.com/");
<br> location.href=url;
<br> </script>
<br> <br> <br> <br></body>
<br></html><br></div>