Home  >  Article  >  Backend Development  >  php 自动提交表单登录解决办法

php 自动提交表单登录解决办法

WBOY
WBOYOriginal
2016-06-13 12:01:231193browse

php 自动提交表单登录
实现功能:利用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 = "[email protected]";
$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();  
?>
------解决方案--------------------
楼主可以尝试将 用户名密码放到加密的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