Alireza
Alireza

Reputation: 5673

how to request to a remote server with cookies included (PHP/javascript)

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?

Upvotes: 0

Views: 768

Answers (2)

Gumbo
Gumbo

Reputation: 655359

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

Upvotes: 0

Jan Hančič
Jan Hančič

Reputation: 53929

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

Upvotes: 3

Related Questions