菜鸟请教post的问题 我现在想用php登陆一个网站,然后再采取其他操作。网站是用post的方法获取信息的。我怎样才能实现把我的用户名和密码传递进那个网站呢? 不胜感激! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <form action="那个网站的url" method="post"><input type="user" name="user" value=""><input type="password" name="password" value=""><input type="submit" value="提交"></form> 也可以用隐藏域传过去。 可是这样的话,还是得按那个提交按钮,然后就转到那个页面。 我希望能运行这个php文件就直接登录进那个页面,然后直接进行我想要的操作。 那你用js控制。让页面加载完就提交表单就行了。window.onload=function(){ document.表单名.submit();} 直接通过$_post['name'],$_post['pwd'],可以取到值。 <script>window.onload=function(){ document.test.submit();}</script><form action="那个网站的url" name="test" method="post"><input type="user" name="user" value=""><input type="password" name="password" value=""></form> <html><head><title></title><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /></head><scrip>function login(){ document.xxx.submit();}</script><body onload="login()"><form action="那个网站的url" method="post" name="xxx" style="display:none;"><input type="user" name="user" value="这里填上你的用户名"><input type="password" name="password" value="这里填上你的密码"><input type="submit" value="提交"></form></body></html> 几句PHP代码就可以实现$post = array();$post = array( "name" =>'admin' 'pwd' =>'12345' );$ch = curl_init();curl_setopt($ch, CURLOPT_URL, 你要去的url地址);curl_setopt($ch, CURLOPT_POST, true);curl_setopt($ch, CURLOPT_HEADER, 0);curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);curl_setopt($ch, CURLOPT_USERAGENT, "Xpub pusher Ver 1.0");curl_setopt($ch, CURLOPT_POST, true);curl_setopt($ch, CURLOPT_VERBOSE, 1);curl_setopt($ch, CURLOPT_POSTFIELDS, $post);$r = curl_exec($ch);echo $r; 这位,我之前在网上也搜到了这个,但我不知道curl要配置或安装什么东西? 问一个GLOBALS的问题 php排行榜 php如何生成静态页并且能得到相应的CSS样式 如何实现 23:55分 后再加10分钟后变成第二天的0:5分 该怎么解决啊,大家进来看看啊 php中删除html标签里的属性(可用正则表达式) 求PHP可以上传文件的代码 我用PHP取checkbox提交上来的数据,为什么只取到最后一个checkbox的值 ForntPage中插入数据库不好使啊~~ 表单提交问题!(急!) 关于SNS的一些算法问题 使用php将数据写入mysql,但连接时没反应,没说连接成功也没说连接失败,会有哪些原因?
<input type="user" name="user" value="">
<input type="password" name="password" value="">
<input type="submit" value="提交">
</form> 也可以用隐藏域传过去。
document.表单名.submit();
}
<script>
window.onload=function(){
document.test.submit();
}
</script>
<form action="那个网站的url" name="test" method="post">
<input type="user" name="user" value="">
<input type="password" name="password" value="">
</form>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<scrip>
function login(){
document.xxx.submit();
}</script>
<body onload="login()">
<form action="那个网站的url" method="post" name="xxx" style="display:none;">
<input type="user" name="user" value="这里填上你的用户名">
<input type="password" name="password" value="这里填上你的密码">
<input type="submit" value="提交">
</form>
</body>
</html>
$post = array(
"name" =>'admin'
'pwd' =>'12345'
);$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 你要去的url地址);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERAGENT, "Xpub pusher Ver 1.0");
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
$r = curl_exec($ch);
echo $r;