PDA

View Full Version : POST request - getting cookie



Trok
16th September 2012, 21:05
Hi, I have a problem with sending request by POST method. I need to obtain this kind of values:

[truncated] Cookie: PHPSESSID=ob2ruo5p0dkl4rka8gebalkjf5; __utmc=1; __utma=1.789422630.1347752739.1347752739.134775273 9.1; __utmb=1.1.10.1347752739; __utmz=1.1347752739.1.1.utmcsr=(direct)|utmccn=(di rect)|utmcmd=(none); __utmc=122885273; _
to send correct request. How do I get it? I use QNetworkAccessManager class to communicate with server, and checking requests by Whireshark where i found only this difference between original request and genereted by me. The server reply is: "Content-encoded entity body (gzip): 20 bytes [Error: Decompression failed]". Thanks in advance.

wysota
16th September 2012, 21:13
These are cookies. The server should have sent you some response to an earlier request with "Set-Cookie" header containing those values.

Trok
16th September 2012, 22:50
Thanks for your help. I received value of "Set-Cookie" now, but it contains just PHPSESSID, without remaining fields (__utmc, __utma etc.). When fill new header with this value, result is still the same. Where can i find the rest of this fields?

ChrisW67
17th September 2012, 00:32
Each of those "fields" is a separate cookie. If the server did not send them to you then they don't exist and QNetworkAccessManager cannot return them with later requests. In the case of the __utma through __utmz cookies they are from Google Analytics and probably will not be set unless you execute the Javascript Google urchin in the returned page.