Post 以编程方式登录到网站

Post 以编程方式登录到网站,post,curl,terminal,http-post,Post,Curl,Terminal,Http Post,我正在尝试写一个快速的应用程序来查看我的电费单。为此,我需要能够以编程方式登录该网站,然后才能继续进行其他工作 我知道人们必须以某种方式使用curl。但是,我不知道如何利用curl通过终端登录网站。以下是网站: 查看登录表单的相应源代码,如下所示: <tr> <td nowrap class="form-style-text">User ID:</td> <td class="form-style-label"><input

我正在尝试写一个快速的应用程序来查看我的电费单。为此,我需要能够以编程方式登录该网站,然后才能继续进行其他工作

我知道人们必须以某种方式使用curl。但是,我不知道如何利用curl通过终端登录网站。以下是网站:

查看登录表单的相应源代码,如下所示:

<tr>
    <td nowrap class="form-style-text">User ID:</td>
    <td class="form-style-label"><input type="text" autocomplete="off" size="17" name="loginid" maxlength="32"></td>
</tr>
    <script type="text/javascript">document.wizForm.loginid.focus()</script>
<tr>
    <td class="form-style-text">Password:</td>
    <td class="form-style-label"><input type="password" autocomplete="off" name="password" size="17" maxlength="16"></td>
</tr>
<tr>
    <td class="form-style-text">&nbsp;</td>
    <td align="left">
        <input name="login" type="submit" class="actionbutton" onClick="doLogin()" value="Log in"/>
    </td>
</tr>

有任何关于如何使用terminal/curl登录此页面的线索吗?

您错过了表单标签<代码>

很可能在登录后需要保存会话cookie

您需要做的是使用curl将表单数据发布到/csg/inetSrv。使用参数
--cookie jar
保存cookie。然后,您可以再次使用curl对cookie文件发出请求,并登录

首先在浏览器中检查cookie可能更容易理解它是如何使用的。然后,在使用curl登录之前,您可以尝试使用curl和浏览器会话cookie进行测试

function doLogin() {
    var wform = document.wizForm;
    wform.type.value='LoginMenu';
}