Próbuje napisać bota, który się zaloguje na stronę.
Nie wiem dlaczego nie loguje na forum.
Kod:
# -*- coding: utf-8 -*-
import pycurl
import StringIO
b = StringIO.StringIO()
c = pycurl.Curl()
c.setopt(c.POST, 1)
c.setopt(c.URL, "http://adresjakiegosforum.pl/")
c.setopt(c.HTTPPOST, [("username", 'wpisznazwe'),("password", 'wpiszhaslo'),("redirect", 'index.php'),("login", 'Zaloguj')])
c.setopt(c.NOSIGNAL, 1)
c.setopt(pycurl.WRITEFUNCTION, b.write)
c.setopt(c.VERBOSE, 0)
c.perform()
print c.getinfo(pycurl.HTTP_CODE), c.getinfo(pycurl.EFFECTIVE_URL), c.getinfo(pycurl.TOTAL_TIME)
print b.getvalue()
c.close()