curl对wget的作用有何不同?我正在尝试使用
通过网址访问安全网页https://username:password@website.com
然而,这似乎并没有让我直接进入该页面。如果我用wget尝试相同的网址
wget https://username:password@website.com
我得到ERROR 403: Forbidden
。如果我用curl尝试相同的命令
curl https://username:password@website.com
请求成功。这两个命令有何不同?我想做任何卷曲,但是从浏览器网址。
答案 0 :(得分:1)
您可以通过使用wget
启用调试来查看正在发送的标题{。}}。
-d
您对wget -d https://username:password@website.com
和--request begin--
之间的位感兴趣。以下是https://www.google.com
--request end--
对于---request begin---
GET / HTTP/1.1
User-Agent: Wget/1.16.3 (darwin14.3.0)
Accept: */*
Accept-Encoding: identity
Host: www.google.com
Connection: Keep-Alive
---request end---
HTTP request sent, awaiting response...
,请使用详细标记curl
。您还需要将STDOUT上的内容发送到/ dev / null。
-v
您对开始时curl -v https://username:password@website.com > /dev/null.
的行感兴趣,表示它们是由>
发送的。再次,这里是https://www.google.com
curl
> GET / HTTP/1.1
> Host: www.google.com
> User-Agent: curl/7.44.0
> Accept: */*
>
还会为您提供有关SSL协商的信息。
一种可能性是网站决定使用其用户代理机器人。他们可能会阻止curl
,但忘记了wget
。尝试设置curl
并查看是否能让您进入。