我想用oneliner做一个帖子(本例中是twitter).
如果我没有代理
curl -u user:pass -d status="message" http://twitter.com/statuses/update.xml
Run Code Online (Sandbox Code Playgroud)
工作得很好.
但是,当我在经过身份验证的代理服务器后面时却没有.
我试过了:
curl -X proxy:port -U proxyUser:proxyPass -u user:pass -d status="message" http://twitter.com/statuses/update.xml
Run Code Online (Sandbox Code Playgroud)
它让我跳了起来
代理不支持基本身份验证
所以你知道我做错了什么吗?
提前致谢.
小智 18
Cababunga的答案是正确的,但他们错过了另一种选择:--proxy-ntlm.某些代理无法正确授权--proxy-anyauth,因此理想情况下,您需要指定代理使用的身份验证方法.如果你跑步curl -v -U user:pass -x proxy:port --url http://www.google.com,你应该得到以下内容:
为您在Proxy-Authenticate参数中看到的任何内容添加一个标志,您应该很高兴.在此示例中,您将添加--proxy-ntlm标志.
您可以将用户名/密码放在经过身份验证的资源的 URL 中,以避免出现额外的命令行复杂性。
http://username:password@twitter.com/statuses/update.xml
Run Code Online (Sandbox Code Playgroud)
此外,正如 cababunga 指出的那样,--proxy 快捷方式是小写的 x。
curl -x proxyaddr:port -U proxyUser:proxyPass -u user:pass -d status="message" http://twitter.com/statuses/update.xml
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
46850 次 |
| 最近记录: |