TheMaker 0 Denunciar post Postado Março 8, 2005 Oi galera, Seguinte: Estou fazendo uma aplicação q abre páginas de internet no TWebBrowser e extrai do código fonte o conteúdo relevante. p/ fazer o login na página de internet usei a seguinte procedure: Var EncodedDataString: string; PostData: OleVariant; Headers: OleVariant; I: integer;Begin EncodedDataString := UserField +'='+HTTPEncode(Trim(UserName))+'&'+ PwdField+'='+HTTPEncode(Trim(PassWord)); PostData := VarArrayCreate([0, length(EncodedDataString)-1], varByte); For I := 1 to length(EncodedDataString) Do Begin PostData[I-1] := Ord(EncodedDataString[I]); End; ShowMessage(PostData); Headers := 'Content-type: application/x-www-form-urlencoded'#10#13; WB.Navigate(Trim(Url),EmptyParam, EmptyParam, PostData, Headers);End; Funciona perfeitamente... UserField e PwdField são as variáveis do form na página de web. UserName e Password são os valores q passo p/ essas variáveis. Problema! logo asseguir tem uma página c/ vários menus select (estilo ComboBox).. e já essa parte ñ consigo resolver... O form dessa página é: <form name="frmdata" method="post"> <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr> <td align="center" valign="top"><table width="730" border="0" cellpadding="0" cellspacing="0"> <tr> <td height="40" valign="top"><table width="100%" border="0" cellpadding="2" cellspacing="0" bgcolor="#BFC6CC"> <tr> <td height="30" class="pageCaption"><table width="100%" border="0" cellspacing="0" cellpadding="2"> <tr> <td align="left" valign="bottom" class="pageCaption">Traffic Summary Report </td> <td width="180" align="right" valign="bottom" class="textNormal">This month earned balance: </td> <td width="100" align="left" valign="bottom" class="textNormal"><font color="#0000FF"><strong>$37.00</strong></font></td> </tr> </table></td> </tr> </table></td> </tr> <tr> <td height="60" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="544" height="45" class="textNormal"><a href="GenScript_link.asp" target="_blank" onClick="return popupWindowScroll('GenScript_link.asp',600,350);">Please, click here to create a unique tracking URL for each of your campaigns</a></td> <td width="180" align="right" valign="middle" class="textNormal"><input type="button" name="Submit" value="Add to Favorites" onClick="javascript:return addFav();" style="width:120px;"></td> </tr> <tr> <td colspan="2"><table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr> <td valign="bottom"> </td> <td width="400" align="right"><table width="400" border="1" cellpadding="0" cellspacing="0" bgcolor="#FAFAFA"> <tr> <td><table width="100%" border="0" cellpadding="2" cellspacing="1" bgcolor="#DDDDDD"> <tr> <td height="23" align="center" bgcolor="#E5E5E5" class="labelRequired">Date QuickSelect</td> <td width="10" rowspan="2" bgcolor="#FAFAFA"> </td> <td width="40" align="right" bgcolor="#EFEFEF" class="labelOptional">From:</td> <td width="160" bgcolor="#FAFAFA"><table border="0" cellpadding="0" cellspacing="0"> <tr> <td><select name="seldatefrommo" class="selection" id="select"> <option value="1" >Jan</option> <option value="2" >Feb</option> <option value="3" Selected>Mar</option> <option value="4" >Apr</option> <option value="5" >May</option> <option value="6" >Jun</option> <option value="7" >Jul</option> <option value="8" >Aug</option> <option value="9" >Sep</option> <option value="10" >Oct</option> <option value="11" >Nov</option> <option value="12" >Dec</option> </select> </td> <td> / </td> <td><select name="seldatefromdy" class="selection" id="select2"> <option value="1" >1</option> <option value="2" >2</option> <option value="3" >3</option> <option value="4" >4</option> <option value="5" >5</option> <option value="6" >6</option> <option value="7" Selected>7</option> <option value="8" >8</option> <option value="9" >9</option> <option value="10" >10</option> <option value="11" >11</option> <option value="12" >12</option> <option value="13" >13</option> <option value="14" >14</option> <option value="15" >15</option> <option value="16" >16</option> <option value="17" >17</option> <option value="18" >18</option> <option value="19" >19</option> <option value="20" >20</option> <option value="21" >21</option> <option value="22" >22</option> <option value="23" >23</option> <option value="24" >24</option> <option value="25" >25</option> <option value="26" >26</option> <option value="27" >27</option> <option value="28" >28</option> <option value="29" >29</option> <option value="30" >30</option> <option value="31" >31</option> </select> </td> <td> / </td> <td><select name="seldatefromyr" class="selection" id="select3"> <option value="2003" >2003</option> <option value="2004" >2004</option> <option value="2005" Selected>2005</option> </select> </td> </tr> </table></td> <td width="40" rowspan="2" align="center" valign="bottom" bgcolor="#FAFAFA"><input name="cmdGo" type="submit" class="buttonSmall" id="cmdGo3" value=" GO "></td> </tr> <tr> <td align="center" bgcolor="#FAFAFA" class="textSmaller"><select name="selstat" id="select7" class="selection" onChange="document.frmdata.submit();"> <option>Today</option> <option value="y">Yesterday</option> <option value="tw" selected >This Week</option> <option value="lw" >Last Week</option> <option value="tm" >This Month</option> <option value="lm" >Last Month</option> <option value="at" >All Times</option> </select></td> <td align="right" bgcolor="#E5E5E5" class="labelOptional">To:</td> <td bgcolor="#FAFAFA"><table border="0" cellpadding="0" cellspacing="0"> <tr> <td><select name="seldatetomo" class="selection" id="select4"> <option value="1" >Jan</option> <option value="2" >Feb</option> <option value="3" Selected>Mar</option> <option value="4" >Apr</option> <option value="5" >May</option> <option value="6" >Jun</option> <option value="7" >Jul</option> <option value="8" >Aug</option> <option value="9" >Sep</option> <option value="10" >Oct</option> <option value="11" >Nov</option> <option value="12" >Dec</option> </select> </td> <td> / </td> <td><select name="seldatetody" class="selection" id="select5"> <option value="1" >1</option> <option value="2" >2</option> <option value="3" >3</option> <option value="4" >4</option> <option value="5" >5</option> <option value="6" >6</option> <option value="7" Selected>7</option> <option value="8" >8</option> <option value="9" >9</option> <option value="10" >10</option> <option value="11" >11</option> <option value="12" >12</option> <option value="13" >13</option> <option value="14" >14</option> <option value="15" >15</option> <option value="16" >16</option> <option value="17" >17</option> <option value="18" >18</option> <option value="19" >19</option> <option value="20" >20</option> <option value="21" >21</option> <option value="22" >22</option> <option value="23" >23</option> <option value="24" >24</option> <option value="25" >25</option> <option value="26" >26</option> <option value="27" >27</option> <option value="28" >28</option> <option value="29" >29</option> <option value="30" >30</option> <option value="31" >31</option> </select> </td> <td> / </td> <td><select name="seldatetoyr" class="selection" id="select6"> <option value="2003" >2003</option> <option value="2004" >2004</option> <option value="2005" Selected>2005</option> </select> </td> </tr> </table></td> </tr> </table></td> </tr> </table></td> </tr> <tr> <td height="10" colspan="2"></td> </tr> </table></td> </tr> </table></td> </tr> <tr> <td align="center"><table width="100%" border="1" cellpadding="0" cellspacing="0"> <tr> <td><table width="100%" border="0" cellpadding="2" cellspacing="1" bgcolor="#BFC6CC"> <tr bgcolor="#DDDDDD" class="sectionHeader"> <td height="23">Tracking URL Description </td> <td width="100">Hits</td> <td width="100">Leads</td> <td width="100">Total</td> <td width="60"> </td> </tr> <tr> <td colspan="5" height="1" bgcolor="#000066"></td> </tr> <tr bgcolor="#FAFAFA" class="selection"><td height="27" valign="middle">trafbla</td><td valign="middle">19</td><td valign="middle">2</td><td valign="middle">$6.00</td><td align="center" valign="middle" class="buttonLink"><a href="Affiliate_URL.asp?url=trafbla">Details</a></td></tr><tr bgcolor="#DDDDDD" class="textBold"><td height="27" valign="middle" align="right">Total: </td><td valign="middle">19</td><td valign="middle">2</td><td valign="middle">$6.00</td><td> </td></tr> </table></td> </tr> </table></td> </tr> <tr> <td> </td> </tr> <tr> <td align="right" class="textNormal"><font color="#FF0000">In order to receive affiliate payments, please, fill in the <a href="fw9.pdf" target="_blank">W-9</a> form and fax it to (800) 647-2142</font>.</td> </tr> <tr> <td> </td> </tr> <tr> <td align="right" class="textNormal">If you are done setting up your account, you may <a href="Affiliate_LogOut.asp">click here to logout</a>.</td> </tr> </table></td> </tr> </table></form> Se alguém puder ajudar...! Obrigado. Compartilhar este post Link para o post Compartilhar em outros sites
rdcalheiro 0 Denunciar post Postado Abril 1, 2005 Caro amigo,notei que você consegue autenticar um usuario e senha em uma página web. Tentei usar seu código no meu programa mas naum funcionou.Veja o meu caso e se puder me ajude.No programa tenho dois edits (usuario e senha) e preciso que, ao clicar em um botão do programa, o texto destes edits sejam lançados em uma form de uma página e consequentemente sejam validados pelo botão "enviar" do formulário web...se puder, me ajuda!ValeuRafael! Compartilhar este post Link para o post Compartilhar em outros sites