/    Sign up×
Community /Pin to ProfileBookmark

how to compress a cookie value

Hello

I need to store some very long text inside a cookie using php’s setcookie
the problem is that sometimes the text is too long for the browser to handle

and I get the following error:
400 Bad Request

Your browser sent a request that this server could not understand.
Size of a request header field exceeds server limit.

Is there a way to compress the value I am about to save in the cookie
and then to uncompress it again when I read the value from the cookie?

I just need to make sure that the encoding of the compressed value will be
legal for the browser to store in the cookie so that the uncompression will work

Is this possibe?
I would appreciate leads to PHP compression solutions if possible

regards

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@NogDogFeb 14.2006 — www.php.net/bzcompress

Though you might want to consider using session variables and/or saving in database records if that much data is involved.
Copy linkTweet thisAlerts:
@LiLcRaZyFuZzYFeb 14.2006 — the text is too long for the browser to handle[/QUOTE]

how big is it?
×

Success!

Help @jasongr spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.20,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...