登录网页的脚本

发布于 2024-08-20 06:23:45 字数 183 浏览 1 评论 0原文

我想编写一个脚本来登录并与网页交互,但有点不知道从哪里开始。我也许可以弄清楚 html 解析,但如何处理登录部分?我计划使用 bash,因为这是我最了解的,但我愿意接受任何其他建议。我只是在寻找一些参考资料或链接来帮助我入门。我不太确定密码是否存储在 cookie 或其他什么中,那么我该如何评估这种情况呢?

谢谢,

I want to write a script to log in and interact with a web page, and a bit at a loss as to where to start. I can probably figure out the html parsing, but how do I handle the login part? I was planning on using bash, since that is what I know best, but am open to any other suggestions. I'm just looking for some reference materials or links to help me get started. I'm not really sure if the password is then stored in a cookie or whatnot, so how do I assess the situation as well?

Thanks,

Dan

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

简单气质女生网名 2024-08-27 06:23:45

看一下 cURL,它通常在 Linux/Unix 环境中可用,并且允许您编写脚本调用网页,包括 POST 参数(例如用户名和密码),并允许您管理 cookie 存储,以便后续调用(以获取站点内的不同页面)可以使用相同的 cookie(因此您的登录将跨调用持续存在)。

Take a look a cURL, which is generally available in a Linux/Unix environment, and which lets you script a call to a web page, including POST parameters (say a username and password), and lets you manage the cookie store, so that a subsequent call (to get a different page within the site) can use the same cookie (so your login will persist across calls).

花期渐远 2024-08-27 06:23:45

前段时间我在工作中做了类似的事情,我必须登录页面并一遍又一遍地发布相同的数据......

看看 此处。我使用 wget 因为我没有让它与curl一起工作。

I did something like that at work some time ago, I had to login in a page and post the same data over and over...

Take a look at here. I used wget because I did not get it working with curl.

吾性傲以野 2024-08-27 06:23:45

在此网站上搜索屏幕抓取。它可能会变得很麻烦,因为您需要处理 cookie、javascript 和隐藏字段(视图状态!)。通常,您需要抓取登录页面以获取隐藏字段,然后发布到登录页面。玩得开心:D

Search this site for screen scraping. It can get hairy since you will need to deal with cookies, javascript and hidden fields (viewstate!). Usually you will need to scrape the login page to get the hidden fields and then post to the login page. Have fun :D

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文