php cookie with % in value
up vote
0
down vote
favorite
as php noob I have a problem with php setcookie. I try to achive a cookie which value is "bid_1%257C1544538505%257Ced2d154bb51e2a989fb30fe4250ce602" with php.
This I tried so far... .
$cookieName = 'test';
$value = 'bid_1%7C1544538505%7Ced2d154bb51e2a989fb30fe4250ce602';
$setcookie($cookieName, $value, time()+3600);
What I get is a cookie with a value of:
bid_1%257C1544538505%257Ced2d154bb51e2a989fb30fe4250ce602
How can I achive a correct value and prevent php from transforming "%". Many Thanks in advance.
I tried without success
$value = 'bid_1%%7C1544538505%%7Ced2d154bb51e2a989fb30fe4250ce602';// and
$value = 'bid_1%7C1544538505%7Ced2d154bb51e2a989fb30fe4250ce602';
php cookies setcookie
add a comment |
up vote
0
down vote
favorite
as php noob I have a problem with php setcookie. I try to achive a cookie which value is "bid_1%257C1544538505%257Ced2d154bb51e2a989fb30fe4250ce602" with php.
This I tried so far... .
$cookieName = 'test';
$value = 'bid_1%7C1544538505%7Ced2d154bb51e2a989fb30fe4250ce602';
$setcookie($cookieName, $value, time()+3600);
What I get is a cookie with a value of:
bid_1%257C1544538505%257Ced2d154bb51e2a989fb30fe4250ce602
How can I achive a correct value and prevent php from transforming "%". Many Thanks in advance.
I tried without success
$value = 'bid_1%%7C1544538505%%7Ced2d154bb51e2a989fb30fe4250ce602';// and
$value = 'bid_1%7C1544538505%7Ced2d154bb51e2a989fb30fe4250ce602';
php cookies setcookie
1
I suggest looking at php setrawcookie which might resolve your problem
– Jérôme B
Nov 21 at 15:16
@JérômeB this was exactly, what resolved my problem. Thanks a bunch!
– Friedrich Siever
Nov 21 at 15:24
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
as php noob I have a problem with php setcookie. I try to achive a cookie which value is "bid_1%257C1544538505%257Ced2d154bb51e2a989fb30fe4250ce602" with php.
This I tried so far... .
$cookieName = 'test';
$value = 'bid_1%7C1544538505%7Ced2d154bb51e2a989fb30fe4250ce602';
$setcookie($cookieName, $value, time()+3600);
What I get is a cookie with a value of:
bid_1%257C1544538505%257Ced2d154bb51e2a989fb30fe4250ce602
How can I achive a correct value and prevent php from transforming "%". Many Thanks in advance.
I tried without success
$value = 'bid_1%%7C1544538505%%7Ced2d154bb51e2a989fb30fe4250ce602';// and
$value = 'bid_1%7C1544538505%7Ced2d154bb51e2a989fb30fe4250ce602';
php cookies setcookie
as php noob I have a problem with php setcookie. I try to achive a cookie which value is "bid_1%257C1544538505%257Ced2d154bb51e2a989fb30fe4250ce602" with php.
This I tried so far... .
$cookieName = 'test';
$value = 'bid_1%7C1544538505%7Ced2d154bb51e2a989fb30fe4250ce602';
$setcookie($cookieName, $value, time()+3600);
What I get is a cookie with a value of:
bid_1%257C1544538505%257Ced2d154bb51e2a989fb30fe4250ce602
How can I achive a correct value and prevent php from transforming "%". Many Thanks in advance.
I tried without success
$value = 'bid_1%%7C1544538505%%7Ced2d154bb51e2a989fb30fe4250ce602';// and
$value = 'bid_1%7C1544538505%7Ced2d154bb51e2a989fb30fe4250ce602';
php cookies setcookie
php cookies setcookie
edited Nov 21 at 15:17
asked Nov 21 at 14:53
Friedrich Siever
947
947
1
I suggest looking at php setrawcookie which might resolve your problem
– Jérôme B
Nov 21 at 15:16
@JérômeB this was exactly, what resolved my problem. Thanks a bunch!
– Friedrich Siever
Nov 21 at 15:24
add a comment |
1
I suggest looking at php setrawcookie which might resolve your problem
– Jérôme B
Nov 21 at 15:16
@JérômeB this was exactly, what resolved my problem. Thanks a bunch!
– Friedrich Siever
Nov 21 at 15:24
1
1
I suggest looking at php setrawcookie which might resolve your problem
– Jérôme B
Nov 21 at 15:16
I suggest looking at php setrawcookie which might resolve your problem
– Jérôme B
Nov 21 at 15:16
@JérômeB this was exactly, what resolved my problem. Thanks a bunch!
– Friedrich Siever
Nov 21 at 15:24
@JérômeB this was exactly, what resolved my problem. Thanks a bunch!
– Friedrich Siever
Nov 21 at 15:24
add a comment |
2 Answers
2
active
oldest
votes
up vote
1
down vote
accepted
Basically the root problem is that setcookie encodes your value, therefore some characters like %
are encoded as %25
Solution
setrawcookie doesn't have this feature and therefore returns the result you want
No, the root problem is that they are trying to re-encode something that they already ran throughurlencode()
. (That's not to say your answer won't work of course.)
– miken32
Nov 21 at 16:56
add a comment |
up vote
2
down vote
What I get is a cookie with a value of
No. What you quoted there is a representation of the actual value. What is stored on the client, and is returned in subsequent requests is the same value you passed as an argument to setcookie().
add a comment |
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
accepted
Basically the root problem is that setcookie encodes your value, therefore some characters like %
are encoded as %25
Solution
setrawcookie doesn't have this feature and therefore returns the result you want
No, the root problem is that they are trying to re-encode something that they already ran throughurlencode()
. (That's not to say your answer won't work of course.)
– miken32
Nov 21 at 16:56
add a comment |
up vote
1
down vote
accepted
Basically the root problem is that setcookie encodes your value, therefore some characters like %
are encoded as %25
Solution
setrawcookie doesn't have this feature and therefore returns the result you want
No, the root problem is that they are trying to re-encode something that they already ran throughurlencode()
. (That's not to say your answer won't work of course.)
– miken32
Nov 21 at 16:56
add a comment |
up vote
1
down vote
accepted
up vote
1
down vote
accepted
Basically the root problem is that setcookie encodes your value, therefore some characters like %
are encoded as %25
Solution
setrawcookie doesn't have this feature and therefore returns the result you want
Basically the root problem is that setcookie encodes your value, therefore some characters like %
are encoded as %25
Solution
setrawcookie doesn't have this feature and therefore returns the result you want
edited Nov 21 at 15:47
answered Nov 21 at 15:38
Jérôme B
10112
10112
No, the root problem is that they are trying to re-encode something that they already ran throughurlencode()
. (That's not to say your answer won't work of course.)
– miken32
Nov 21 at 16:56
add a comment |
No, the root problem is that they are trying to re-encode something that they already ran throughurlencode()
. (That's not to say your answer won't work of course.)
– miken32
Nov 21 at 16:56
No, the root problem is that they are trying to re-encode something that they already ran through
urlencode()
. (That's not to say your answer won't work of course.)– miken32
Nov 21 at 16:56
No, the root problem is that they are trying to re-encode something that they already ran through
urlencode()
. (That's not to say your answer won't work of course.)– miken32
Nov 21 at 16:56
add a comment |
up vote
2
down vote
What I get is a cookie with a value of
No. What you quoted there is a representation of the actual value. What is stored on the client, and is returned in subsequent requests is the same value you passed as an argument to setcookie().
add a comment |
up vote
2
down vote
What I get is a cookie with a value of
No. What you quoted there is a representation of the actual value. What is stored on the client, and is returned in subsequent requests is the same value you passed as an argument to setcookie().
add a comment |
up vote
2
down vote
up vote
2
down vote
What I get is a cookie with a value of
No. What you quoted there is a representation of the actual value. What is stored on the client, and is returned in subsequent requests is the same value you passed as an argument to setcookie().
What I get is a cookie with a value of
No. What you quoted there is a representation of the actual value. What is stored on the client, and is returned in subsequent requests is the same value you passed as an argument to setcookie().
answered Nov 21 at 15:18
symcbean
40.6k44076
40.6k44076
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53414721%2fphp-cookie-with-in-value%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
I suggest looking at php setrawcookie which might resolve your problem
– Jérôme B
Nov 21 at 15:16
@JérômeB this was exactly, what resolved my problem. Thanks a bunch!
– Friedrich Siever
Nov 21 at 15:24