首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > VC/MFC >

用WinInet提交HTTPS表单 — 怎么构造表单字符串

2012-04-04 
用WinInet提交HTTPS表单 — 如何构造表单字符串?想用程序代替浏览器提交表单数据到HTTPS服务器(发送POST请

用WinInet提交HTTPS表单 — 如何构造表单字符串?
想用程序代替浏览器提交表单数据到HTTPS服务器(发送POST请求),其中目标网址为:https://www.edline.net/Index.page

该网页源代码中用户名、密码表单的关键代码如下:
   
<form id="authenticationEntryForm" name="authenticationEntryForm" action="https://www.edline.net/post/Index.page" method="post" > 
<label for="screenName">Screen Name</label>  
<div class="ed-inputWrapper"><input type="text" id="screenName" name="screenName" tabindex="1" /></div> 
<label for="password">Password</label> 
<div class="ed-inputWrapper"><input type="password" id="password" name="kclq" maxlength="104" tabindex="2" /></div> 
<a role="button" href="#" onclick="return false;" id="signIn" >Sign In</a> 
</form>

程序调用WinInet库的HttpSendRequest函数来实现表单的提交,向服务器发送POST请求,其中,HttpSendRequest函数的参数4为表单提交的内容
(在MSDN中,该参数定义为:Pointer to a buffer containing any optional data to be sent immediately after the request headers.)



采用下面2种字符串都没有成功提交数据到服务器:
screenName="test"&password="test"
screenName="test"&kclq="test"

表单的字符串如何构造呢?请各位帮忙!

[解决办法]
先用IE提交,用抓个包看看,得到需要提交的数据,然后用WININET的CInternetSession类相关模拟提交数据
http://blog.csdn.net/visualeleven/article/details/6656224

热点排行