如何在没有浏览器的情况下自动定期提交html表单?

时间:2014-06-21 12:15:51

标签: javascript bash authentication web

我的ISP要求我每次连接互联网时都在网页上提交我的用户/通行证。它还有一个最大登录超时(大约10个小时),让我出来并要求我再次登录。我需要一个Windows和Linux的命令提示符脚本/批处理文件,它可以自动提交我的帐户信息,而无需打开Web浏览器。

以下html代码是登录页面的源代码。

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>EE> login</title>
</head>
<body>
<input name="username" type="text" value="username"/></td>
<input name="password" type="password" value="passwordtext"/></td>
<input type="submit" value="OK" /></td>
<script type="text/javascript">
<!--
  document.login.username.focus();
//-->
</script>
</body>
</html>

1 个答案:

答案 0 :(得分:0)

来自cURL Tutorial的示例:

curl --data "birthyear=1905&press=%20OK%20"  http://www.example.com/when.cgi