# coding: utf-8
import urllib,urllib2,cookielib
cj = cookielib.CookieJar()
opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
urllib2.install_opener(opener)
params = urllib.urlencode({'login':***,'passwd':***,'action':'login'})
opener.open('https://www.free-lance.ru/login.php', params)
open('1.htm','wb').write(opener.open('http://www.free-lance.ru/').read())
Заголовок вот такой:
----------------------------------------------------------
https://www.free-lance.ru/
POST / HTTP/1.1
Host: www.free-lance.ru
User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:15.0) Gecko/20100101 Firefox/15.0.1
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: be-by,be;q=0.8,en-us;q=0.5,en;q=0.3
Accept-Encoding: gzip, deflate
Connection: keep-alive
Referer: https://www.free-lance.ru/login.php
Cookie: XUUID=8fb7ebc3c1d0627d5e20de57bbc33d7b.MTc4LjE1NC4yOS40MXQxMw%3D%3D; __utma=203583303.1695000882.1347268668.1348092069.1348092965.7; __utmz=203583303.1348092965.7.2.utmcsr=google|utmccn=(organic)|utmcmd=organic|utmctr=(not%20provided); new_pf0=1; new_pf10=1; PHPSESSID=mgjoq5rgur2r1v44u42hilljp3; __utmc=203583303; __utmb=203583303.11.10.1348092965; _ym_visorc=w
Content-Type: application/x-www-form-urlencoded
Content-Length: 65
login=***&passwd=***&action=login&redirect=%252Flogin.php
HTTP/1.1 302 Found
Server: nginx
Date: Wed, 19 Sep 2012 22:36:16 GMT
Content-Type: text/html; charset=windows-1251
Connection: keep-alive
X-Powered-By: PHP/5.2.17
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Location: https://www.free-lance.ru/login.php
Content-Length: 0
----------------------------------------------------------
Что надо исправить, чтобы авторизация сработала?