0

我需要登录,收集任何 cookie,然后继续到经过身份验证的下一页。

<form action="logon.asp"  method="post" name="FmDefault" id="CkIn">    
<table width="90%" border="0" cellpadding="0" cellspacing="0">
<tr>    
   <td colspan="2">
       <div align="right"><img src="images/some_image.gif" width="85" height="20">

         <input name="u_id" type="text" size="15" maxlength="10">

       </div>
   </td>
</tr>
<tr>
    <td colspan="2">
       <div align="right"><img src="images/some_other_image.gif" width="85" height="20">

        <input name="ps_word" type=password size="15" maxlength="10">

       </div>
     </td>
 </tr>
 <tr> 
    <td colspan="2">
       <div align="right">

         <input alt="Login" type="image" src="images/button_image.gif" width="57" height="25" border="0">
        </div>
     </td>
 </tr>
 <tr>
 <td><font color='#ff0000'>

<!---    
<b>ATTENTION: <br>    
</b></font><b><span class="style1"><a href="http://www.example.com/holiday2009.asp" target="_blank" style="color:#00FF00;">CLICK HERE FOR THE <br>    
EXAMPLE 2008 HOLIDAY SCHEDULE!</a></span></b>    
-->    
</td>    
</tr>
</table>
</form>
4

1 回答 1

1
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, 'http://example.com/logon.asp');
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS, 'u_id=YOUR_USERNAME&ps_word=YOUR_PASSWORD');
    curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookie.txt');
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_TIMEOUT, 60);
    $store = curl_exec($ch);
于 2012-04-26T08:52:53.430 回答