如何使用下一个查询发布请求?
请求正文:
_username=test%40test.com&_password=1234&_remember_me=true
PHP:
$opts = array('http'=>
array(
'proxy'=>"",
'method'=>"POST",
'header'=>"User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:51.0) Gecko/20100101 Firefox/51.0"
));
$context = stream_context_create($opts);
$result = file_get_contents('https://website.com/login_check', false, $context);
答案 0 :(得分:0)
有关详细信息,请查看docs
$opts = array(
'http'=>
array(
'proxy' => "",
'method' => "POST",
'content' => '_username=test%40test.com&_password=1234&_remember_me=true',
'header' => "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:51.0) Gecko/20100101 Firefox/51.0"
)
);
$context = stream_context_create($opts);
$result = file_get_contents('https://website.com/login_check', false, $context);