Script well written? It's got a blaring error in its first few lines
$value = $_POST['value'];
if(isset($value)) {
setcookie("cookie", $value, time() + 3600, "/tests/", "http://154.20.148.186:1716", 0);
}
You're checking if a value is set AFTER taking it. If error reporting was on it would create a notice on its first run. Change it to
if (isset($_POST['value']))
{
$value = $_POST['value'];
setcookie("cookie", $value, time() + 3600, "/tests/", "http://154.20.148.186:1716", 0);
}
Also if you're testing cookie scripts it's a good idea to set the cookie lifetime WAY in the future, over a day as differences in the server time and your computer can cause the cookie to be considered dead the second it's thrown at you.
You've also supplied a script to test if cookies are set out of the path the cookie is allowed to be set in, which is "/tests/", so also make that "/" until you've got things working.
You're also checking for the success of cookie being set by checking the $_COOKIE array. This won't tell you if a cookie is set until the 3rd time the script is run. You should check the return value of setcookie.
Now I think you might have enough info to create a well written script.