views:

124

answers:

2

hi I want to send a request including cookies to a HTTP website.

How I can do this?

I sent a request without cookies as a first-time visit and tracked the header there was a cookie inside responded header like this:

Set-cookie: ERIGHTS=VQPFIWEdiYEtW4Eko2T3bikz4H2dDx2FtH-zlTTRFyzW+urkCU7bwGj2w==
Set-cookie: WLSESSION=1512202892.20480.0000

Now how I can send a new request with theses cookies included?

+3  A: 

Use PHP's cURL, you can do that and much more with it.

Jan Hančič
upvoted and added link to using cookies with curl
Gordon
thanks, is there any brief tutorial with php examples for using cURL ? please help
safaali
You'll find plenty with Google. And one is on the second link (the one Gordon added)
Jan Hančič
A: 

The counterpart of the response header field Set-Cookie is the request header field Cookie. So the request header with that cookies could look like this:

Cookie: ERIGHTS=VQPFIWEdiYEtW4Eko2T3bikz4H2dDx2FtH-zlTTRFyzW+urkCU7bwGj2w==, WLSESSION=1512202892.20480.0000
Gumbo
let me try this ...........
safaali
the header says : Set-cookie: ERIGHTS=mx2FzxxQIipxxfVArtQrcU5h42Cg2IQIqiMe-oehmg24bkzHplCtmgn7zMA==;path=/;domain=.xxx.org Set-cookie: WLSESSION=1579311756.20480.0000; expires=Tue, 29-Dec-2009 13:32:07 GMT; path=/ Location: http://www.xxx.org/xxx.zip So what now?
safaali
@safaali: The additional parameter like *path*, *domain* and *expires* are only to restrict the validity of that cookie. You need to validate that information before sending the cookie (e.g. *path* value must be a prefix of the URL path and *domain* a suffix of the URL domain you want to send the cookie to).
Gumbo