0

I am having problems getting a PHP script to write a cookie on an HTTPS site when the same script rules fine on an HTTP one.

The Code:

setcookie('testme', 'test', time()+7200, '/', '', isset($_SERVER["HTTPS"]), true);

In fact I have tried many different ways but none work. This is just a simple version.

I have also tried:

$temp = 'example.co.uk';
setcookie('testme', 'test', time()+7200, '/', $temp, isset($_SERVER["HTTPS"]), true);

Found a fix, I moved the code to the top and it worked fine, I have no idea why it was working on the test server as I know headers must be at the top. Sorry I was misleading people by looking in the wrong place.

DaveG
  • 1
  • 1

0 Answers0