Hello, I'm new to Qt and I hope that someone can help me.

What I want to do is to get some data from index.php as a logged user and parse it later in my app. So I created a post request on index.php with regular post data for a form (username, password, action - all this stuff was sniffed when I was logging in with browser - so its exactly what the php expects), but I fail to handle cookies. Let me show the code:

Qt Code:
  1. QNetworkAccessManager *manager = new QNetworkAccessManager(this);
  2.  
  3. connect(manager,SIGNAL(finished(QNetworkReply*)),this,SLOT(replyFinished(QNetworkReply*)));
  4.  
  5. QNetworkRequest request;
  6. request.setUrl(QUrl("https://serveradress/index.php"));
  7.  
  8. QByteArray postData;
  9. postData.append("Cookie: PHPSESSID=randomnumber;\n\n"); // sniffer I use says that no cookies were sent, but if I leave this out server says that I should enable cookies
  10. postData.append("username=mylogin&password=mypassword&action=login"); // post data
  11.  
  12.  
  13. manager->post(QNetworkRequest(request),postData);
To copy to clipboard, switch view to plain text mode 

But it still won't log me in (it says that username is empty - I noticed that after I log in with browser, server sends back more cookies containing also one username).
So I would like to handle cookies otherwise, from what I understand I need to get a fresh cookie from server and use that for further requests - or can I handle this in one single request, ignoring the cookies that server sends back to me ?