QNetworkRequest request(QUrl("http://chemogu.ru/login/ajax-login/")); QNetworkCookieJar *jar = new QNetworkCookieJar; m_NAM.setCookieJar(jar); request.setRawHeader("User-Agent", "Mozilla/5.0 (X11; U; Linux i686; ru; rv:1.9b5) Gecko/2008050509 Firefox/3.0b5"); request.setRawHeader("Referer", "http://chemogu.ru/"); request.setRawHeader("Pragma", "no-cache"); request.setRawHeader("Host", "chemogu.ru"); request.setRawHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8"); request.setRawHeader("Accept", "application/json, text/javascript, */*; q=0.01"); request.setRawHeader("X-Requested-With", "XMLHttpRequest"); request.setRawHeader("Content-Length", "131"); request.setRawHeader("Connection", "keep-alive"); request.setRawHeader("Cache-control", "no-cache"); request.setRawHeader("Accept-Language", "ru=RU,ru;q=0.8,en=US;q=0.5,eb;q=0.3"); request.setRawHeader("Accept-Encoding", "gzip, deflate"); request.setRawHeader("Accept", "application/json, text/javascript, \"/\"; q=0.01"); m_NAM.post(request, "login=*********&password=*******&remember=on&return-path=http%3A%2F%2Fchemogu.ru%2F&security_ls_key=f197d25d6a04db642aa23dfd7b14861f");
QNetworkRequest request(QUrl("http://chemogu.ru/login/ajax-login/")); request.setRawHeader("User-Agent", "Mozilla/5.0 (X11; U; Linux i686; ru; rv:1.9b5) Gecko/2008050509 Firefox/3.0b5"); request.setRawHeader("Referer", "http://chemogu.ru/"); request.setRawHeader("Pragma", "no-cache"); request.setRawHeader("Host", "chemogu.ru"); request.setRawHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8"); request.setRawHeader("Accept", "application/json, text/javascript, */*; q=0.01"); request.setRawHeader("X-Requested-With", "XMLHttpRequest"); request.setRawHeader("Content-Length", "131"); request.setRawHeader("Connection", "keep-alive"); request.setRawHeader("Cache-control", "no-cache"); request.setRawHeader("Accept-Language", "ru=RU,ru;q=0.8,en=US;q=0.5,eb;q=0.3"); request.setRawHeader("Accept-Encoding", "gzip, deflate"); request.setRawHeader("Accept", "application/json, text/javascript, \"/\"; q=0.01"); QNetworkCookieJar *jar = new QNetworkCookieJar; m_NAM.setCookieJar(jar); m_NAM.post(request, "login=**********&password=********" \ "&remember=on&return-path=http%3A%2F%2Fchemogu.ru%2F&" \ "security_ls_key="+key.toUtf8());
class RemadedNetworkCookieJar: public QNetworkCookieJar{public: RemadedNetworkCookieJar(QObject *parent = 0); virtual ~RemadedNetworkCookieJar(); QList<QNetworkCookie> getAllCookies(); void setAllSitesCookies(const QList<QNetworkCookie>& cookieList);};
RemadedNetworkCookieJar::RemadedNetworkCookieJar(QObject *parent) : QNetworkCookieJar(parent) { }QList<QNetworkCookie> RemadedNetworkCookieJar::getAllCookies(){ return allCookies();}void RemadedNetworkCookieJar::setAllSitesCookies(const QList<QNetworkCookie>& cookieList){ setAllCookies(cookieList);}RemadedNetworkCookieJar::~RemadedNetworkCookieJar() { }