VC 使用IE浏览器打开网页,如何自动提交表单
只能是打开电脑本身的ie浏览器,不能是使用webbrower等控件。
建立了一个对话框程序
在OnInitDialog()
使用IE打开对应的网页
ShellExecute(NULL, _T("open"), _T("IExplore.exe"), _T("http://dddl.gs.tax.cn/js_sso_server/login?service=http%3A%2F%2Fportal.gs.tax.cn%2Fwelcome.html"), NULL, SW_SHOW);
之前使用抓包工具fiddler2
1、浏览器打开http://dddl.gs.tax.cn/js_sso_server/login?service=http%3A%2F%2Fportal.gs.tax.cn%2Fwelcome.html
get 请求,返回cookie: JSESSIONID=lQPxxxxxxxxxxxxxxxxxxxxxxxxxxxx!-1168173757
2、输入用户名和密码,点击表单登录按钮
post请求,网址http://dddl.gs.tax.cn/js_sso_server/login;jsessionid=lQPxxxxxxxxxxxxxxxxxxxxxxxxxxxx!-1168173757?service=http%3A%2F%2Fportal.gs.tax.cn%2Fwelcome.html
就是访问地址加上了jsessionid
cookie: JSESSIONID=lQPxxxxxxxxxxxxxxxxxxxxxxxxxxxx!-1168173757
username=xx&password=xx&brower=xx&ip=xx&hostname=xx&app=service%Dhttp%2A%2F%2Fportal.gs.tax.cn%2Fwelcome.html&yzm=&swrydm=<=LT-145174-XXXXXX0j&execution=e1s1&_eventId=submit&submit=%E7%99%BB%E5%BD%95
之前已经也已经获取登录网页的源码,是一个表单<FORM></FORM>
表单id是fm1,
两个文本输入框 input type="text"
id分别是 username和password,初始value取值为空
一个提交按钮<input type="submit" value="登录" />,name="submit",没有id,
如何自动提交表单
有哪几种方法实现?