Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
QNetworkAccesManager can't get to another page after NetworkRequest post
DomantasB last edited by
After I succsesfully send post request and login to page I can't get to another page during same session. for example
But reply returns me only login.php page.
Here is my code
manager = new QNetworkAccessManager ();
manager->setCookieJar(new QNetworkCookieJar); req.setHeader(req.UserAgentHeader,"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.2 (KHTML, like Gecko) Chrome/15.0.874.121 Safari/535.2"); req.setHeader(QNetworkRequest::ContentTypeHeader,"application/x-www-form-urlencoded"); req.setUrl(QUrl("www.example.com/login")); QByteArray postData; postData.append("login_user=user&"); postData.append("login_passwd=Pass"); connect (manager, SIGNAL(finished(QNetworkReply *)), this, SLOT(writeToTxt(QNetworkReply *))); manager->post(req, postData); manager->get(QNetworkRequest(address)); manager->get(QNetworkRequest(QUrl("www.example.com/example.html")));@
I just have no idea where to start searching for problem. Post any ideas i will really appreciate them.
And sorry English is not my native language.
RoboC0der last edited by
you should get session ID from webpage and keep that to GET or POST .