cURLアクセスHTTPSウェブサイト

cURLアクセスHTTPSウェブサイト

cURLを使用して次のWebサイトにアクセスしようとしています。 (https://www.fleetagent.be) 次のスイッチを使用して cURL を設定しましたが、-L -k --proxy [username:password] 次のエラーが発生します。 cURLを使用してWebサイトを取得するには、どのスイッチを追加する必要がありますか?

URLhttps://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

このポータルにアカウントがあるとします。カールコールに以下を追加します。

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

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

実際のウェブサイトのユーザー名とパスワードではなく、エージェントのユーザー名とパスワードのみを送信してください。

おすすめ記事