如何使用curl对web服务进行身份验证?

发布于 2024-09-26 02:16:06 字数 99 浏览 0 评论 0原文

我正在尝试让curl 为我正在使用的网站运行网络服务。该网站需要登录。我尝试将 --user:password 与curl 一起使用,但无济于事。我如何了解如何通过该网站进行身份验证?

I am trying to get curl to run a webservice for a site I am working with. The site requires a login. I tried using --user:password with curl, but to no avail. How do I find out how to authenticate with the site?

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

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

发布评论

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

评论(1

天冷不及心凉 2024-10-03 02:16:06

对于您需要的 http 标头,这可能需要一些尝试和错误。当我必须对curl 做类似的事情时,我最终进行了多次curl 调用。第一个将登录网站并存储 cookie。第二次调用将使用 cookie 并执行真正的业务。

这是一个示例: http://curl.haxx.se/libcurl/php/examples /ebay_login.html

This will probably take some trial and error with regards to what http-headers you need. When I had to do something similar with curl, I ended up doing multiple curl calls. First one would log into the site and store a cookie. Second call would use the cookie and do the real business.

Here's an example: http://curl.haxx.se/libcurl/php/examples/ebay_login.html

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