Is there any way to get all cookies set in php application (with no request) ? I want to do something like this:
setcookie("cookieName", "test");
print_r($_COOKIE);
Above code of course doesn't work (work only when app is requested by browser)
You can use headers_list()
which will give you an array of headers that are ready to be sent to the client,
headers_list(); //doesn't take any params
eg result:
Array ( [0] => X-Powered-By: PHP/5.5.9-1ubuntu4.9 [1] => Set-Cookie: cookieName=test )