Home >Backend Development >PHP Tutorial >php 自动提交表单登录

php 自动提交表单登录

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-23 13:54:381872browse

实现功能:利用com的internetexplorer.application,去控制ie空间进行自动填写表单登录。在其他网页能够实现自动登录,但是在下边这个网站就是登录不了.求解?

$Browser = new COM('InternetExplorer.Application');     
$Browserhandle = $Browser->HWND;     
$Browser->Visible = true;     
$f1_url = "http://www.marriott.com.cn/default.mi";     
$Browser->Navigate($f1_url);   
while ($Browser->Busy) {
com_message_pump(4000);
}  
sleep(5);   
$Browser->Document->getElementById('header-my-account-userid')->focus();
$Browser->Document->getElementById('header-my-account-userid')->value = "cz447307145@163.com";
$Browser->Document->getElementById('header-my-account-password')->focus();     
$Browser->Document->getElementById('header-my-account-password')->value = "wuweiqun6811695";
$Browser->Document->getElementById('header-my-account-sign-in')->focus();     
$Browser->Document->getElementById('header-my-account-sign-in')->click();

echo "ok"; 
//$Browser->Quit();  
?>


回复讨论(解决方案)

没怎么看懂,楼主是想要自动登录功能吗?

没怎么看懂,楼主是想要自动登录功能吗?


是啊,上边的代码已经能够实现自动输入帐号和密码了,但是没办法自动点击登录按键.我用163邮箱试过,能够实现自动登录,就是这个网站不行!能知道为什么么?

楼主可以尝试将 用户名密码放到加密的cookie中,然后从cookie中取到登陆信息,如果ok就登陆成功啦

只能用绘画控制了

换个页面登录https://www.marriott.com.cn/Channels/rewards/signIn-cn.mi

其实换了一个浏览器就可以了!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn