Почему не работает?
$postdata = http_build_query(
array(
'email' => '[email protected]',
'password' => '3333'
)
);
$opts = array('http' =>
array(
'method' => 'POST',
'header' => 'Content-type: application/x-www-form-urlencoded',
'content' => $postdata
)
);
$context = stream_context_create($opts);
$result = file_get_contents('http://test.ru/loginshopuser.php', false, $context);
В loginshopuser.php:
setcookie("shopuseremail", $email, time()+60*999999, '/');
$_COOKIE["shopuseremail"] = $email;
setcookie("shopuserpassword", $password, time()+60*999999, '/');
$_COOKIE["shopuserpassword"] = $password;
На сайте куки не ставятся
Источник: https://ru.stackoverflow.com/questions/652708/php-set-cookie-file-get-contents
Свежие комментарии