php访问页面自动提交表单,100分求助
访问当前页面自动提交登录信息,求完整的php代码,以下是表单<formaction="login.php"method="POST"><inputtype="text"n...
访问当前页面自动提交登录信息,求完整的php代码,以下是表单
<form action="login.php" method="POST">
<input type="text" name="username"value="admin"><input type="password" name="password" value="admin"><input type="submit" value="确认登陆">
</form> 展开
<form action="login.php" method="POST">
<input type="text" name="username"value="admin"><input type="password" name="password" value="admin"><input type="submit" value="确认登陆">
</form> 展开
展开全部
function do_post_request($url, $data, $optional_headers = null)
{
$params = array('http' => array(
'method' => 'POST',
'content' => $data
));
if ($optional_headers !== null) {
$params['http']['header'] = $optional_headers;
}
$ctx = stream_context_create($params);
$fp = @fopen($url, 'rb', false, $ctx);
if (!$fp) {
throw new Exception("Problem with $url, $php_errormsg");
}
$response = @stream_get_contents($fp);
if ($response === false) {
throw new Exception("Problem reading data from $url, $php_errormsg");
}
return $response;
}
{
$params = array('http' => array(
'method' => 'POST',
'content' => $data
));
if ($optional_headers !== null) {
$params['http']['header'] = $optional_headers;
}
$ctx = stream_context_create($params);
$fp = @fopen($url, 'rb', false, $ctx);
if (!$fp) {
throw new Exception("Problem with $url, $php_errormsg");
}
$response = @stream_get_contents($fp);
if ($response === false) {
throw new Exception("Problem reading data from $url, $php_errormsg");
}
return $response;
}
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询