URL コンテンツの検索とリダイレクトに従う

URL コンテンツの検索とリダイレクトに従う

CentOSからURLにアクセスし、自動的にリダイレクトに従いたいと思います。たとえば、次のようになります。

Visit http://domain.com
This will redirect my by a `header()` to another webpage, so automatically follow this redirect.
And this page will also redirect me.
Save the contents on the `landing` page.

この目標をどのように達成できますか?

ベストアンサー1

curl -L http://domain.com

-L/--location
(HTTP / HTTPS)サーバーが要求したページが別の場所(Location:ヘッダーと3XX応答コードで示されている)に移動したと報告する場合、このオプションを使用すると、カールは新しい場所で要求を再実行します。

またはwget http://domain.com

おすすめ記事