http页面POST问题
可能这个问题已有人问题过好多请了,但请大家也是回答我一下,谢谢。
页面是这样的。
<DT> <SPAN style= "DISPLAY: block "> <INPUT class=input_id id=id onblur= "if (this.value.length==0) {this.className= 'input_id ';} else {this.className= 'input_none ';} " onfocus= "installKeyCrypt(); this.className= 'input_none ' " maxLength=24 name=id> <LABEL for=id> 用户名 </LABEL> </SPAN> <SPAN style= "MARGIN-TOP: 2px; DISPLAY: block "> <INPUT class=input_pw onkeypress= "if(event.keyCode == 13){login();} " id=pw onblur= "if (this.value.length==0) {this.className= 'input_pw ';} else {this.className= 'input_none ';} " onfocus= "installKeyCrypt(); this.className= 'input_none ' " type=password maxLength=16 value= " " name=pw autocomplete= "off "> <LABEL for=pw> 密码 </LABEL> </SPAN> </DT>
<DD> <A onclick= "login(); return false; " href= "# "> <IMG alt=登录 src= "/btn_login.gif "> </A> </DD> </DL> </DIV>
代码:
CppWebBrowser1-> Navigate(WideString(url).c_bstr());
IHTMLDocument2* pDoc;
IHTMLElementCollection* pAll;
IHTMLElement* pBit;
IHTMLInputElement *pUser, *pPWD;
IDispatch* pDisp;
CppWebBrowser1-> Document-> QueryInterface(IID_IHTMLDocument,(void**) & pDoc);
pDoc-> get_all(&pAll);
pAll-> item(TVariant( "id "), TNoParam(), &pDisp);
pDisp-> QueryInterface(IID_IHTMLInputElement, (void**) & pUser);
pDisp-> Release();
WideString myName(id);
pUser-> put_value(myName.c_bstr());
pAll-> item(TVariant( "pw "), TNoParam(), &pDisp);
pDisp-> QueryInterface(IID_IHTMLInputElement, (void**) & pPWD);
pDisp-> Release();
WideString myPWD(pw);
pPWD-> put_value(myPWD.c_bstr());
但没有把ID与PW填入,请问怎么可以完成这个POST过程呢,谢谢。
[解决办法]
因为你用的是get_body获取的网页内容,所以只能得到body段内的文字。