cURL访问HTTPS网站

cURL访问HTTPS网站

我尝试使用 cURL 访问以下网站。 (https://www.fleetagent.be)我使用以下开关配置了 cURL,-L -k --proxy [username:password] 但出现以下错误。获取cURL需要添加哪些开关才能获取网站?

网址https://www.fleetagent.be被重定向到https://www.fleetagent.be/portal/pls/portal。网站以某种方式为重定向的门户进行自我验证。如何使用 cURL 模拟这种行为?

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<HTML><HEAD>
<TITLE>401 Unauthorized</TITLE>
</HEAD><BODY>
<H1>Unauthorized</H1>
This server could not verify that you
are authorized to access the document
requested.  Either you supplied the wrong
credentials (e.g., bad password), or your
browser doesn't understand how to supply
the credentials required.<P>
<P>Additionally, a 404 Not Found
error was encountered while trying to use an ErrorDocument to handle the request.
</BODY></HTML>

答案1

我假设您有这个门户的帐户。将其添加到您的curl 调用中:

--user <user[:password]> Set server user and password

curl -L -k --proxy [username:password] --user <user[:password]> https://www.fleetagent.be/portal/pls/portal

您仅提交代理的用户名和密码,而不是实际网站的用户名和密码。

相关内容