Questions tagged [setcookie]

The setcookie function sends an HTTP cookie to a client.

setcookie() defines a cookie to be sent along with the rest of the HTTP headers. Like other headers, cookies must be sent before any output from your script (this is a protocol restriction). This requires that you place calls to this function prior to any output, including <html> and <head> tags as well as any whitespace.

1196 questions
5
votes
3 answers

How to share the cookie with subdomains

I have over two subdomains in my site. such as:www.example.com, login.example.com, user.example.com, cart.example.com... I setup the cookie_domain as .example.com in config.yml and php.ini when I setCookies('test', 'value', '.example.com'), but the…
Mike Zhang
  • 263
  • 6
  • 10
5
votes
3 answers

Parsing HTTP header 'set-cookie' with HTTParty

I'm using HTTParty for making HTTP requests and for using REST APIs. Now I want to re-use cookies set by a login page I called via POST. class SomeImporter include HTTParty def self.login response =…
Sven R.
  • 1,049
  • 17
  • 24
5
votes
2 answers

jQuery: Set cookie for two domains

I want to set a cookie to a domain, but it should be available for a sub domain as well. e.g. www.mydomain.com and sub.mydomain.com When I set the cookie to the main domain it doesn't exist for the subdomain. I use jQuery cookie Plugin:…
Artpixler
  • 475
  • 3
  • 6
  • 8
5
votes
1 answer

What is the recommended approach to storing a Session ID

I am building an android application and I am curious for what is "best practice" when it comes to session management. I set up my application to authenticate (to google-play-services). I would like to store a Session Id and have it expire when the…
mornindew
  • 1,993
  • 6
  • 32
  • 54
5
votes
3 answers

Update a cookie value without changing its expiry date?

Update a cookie value without changing its expiry date? $c = $_COOKIE["count"]; $c++; if (isset($_COOKIE["count"])) { setcookie("count", $c); } else { setcookie("count", $c, time() + 86400, '/'); }
UZSTYLE GROUP
  • 65
  • 2
  • 6
4
votes
3 answers

How to set a cookie in jquery using toggle()

Looking for a cookie to be set when the user clicks on the link it'll open the div then the user can refresh the page and see the div is still open. =======HTML======= ========jQuery======= $(function ()…
Davis
  • 2,937
  • 3
  • 18
  • 28
4
votes
1 answer

How to overwrite existing Cookie with new value in PHP?

I have been searching on how to overwrite a certain cookies value like for example in user's information. how can I call the cookie back to the client matched on the user's input. for the cookie to change its value?
Webdev
  • 41
  • 1
  • 1
  • 2
4
votes
1 answer

How to access all HTTP Response Headers

I have a simple mobile app in Titanium that I'm using to debug the ability to log into our user system. At the moment, I cannot seem to see the Set-Cookie response header as it's always returned as null. I'm currently using Titanium SDK 1.7.5 (1.8…
Cyntech
  • 5,362
  • 6
  • 33
  • 47
4
votes
1 answer

Setting cookies in an AJAX call with Django

I have a Django site and I am trying to set a cookie in a response from an AJAX call. I made the question more general since nowbody was answering Cookies not working with an AJAX call from jQuery to Django On the client side I have a JavaScript…
Alex Gonzalez
  • 981
  • 1
  • 11
  • 17
4
votes
1 answer

Firefox won't store cookie when page is loaded within an iframe

I have a parent webpage with a child iframe: parent at https://first-site.com child at