目的
リダイレクトしてリクエストヘッダのURLを取得するコードをcurlで作りたいです。
powershellのhttpclientでは以下のようなコードです。
powershell
1#TLSのバージョンを設定 2[System.Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls13 -bor [Net.SecurityProtocolType]::Tls12 -bor [Net.SecurityProtocolType]::Tls11 3 4#HttpClientを利用する準備 5Add-Type -AssemblyName System.Net.Http 6$handler = New-Object System.Net.Http.HttpClientHandler 7$handler.UseCookies = $false 8$httpClient = New-Object System.Net.Http.HttpClient($handler) 9 10# リクエストヘッダ取得 11$URL = 'http://www.vim.org/scripts/download_script.php?src_id=19574' 12$response = $httpClient.GetAsync($URL, 1) 13$uri = $response.Result.RequestMessage.RequestUri #これがほしい
curlのオプションについていくつか試しました
-vL 余計なものが多すぎてスルーしてしまいました。
-IL 取得することができませんでした
-iL 上に同じ
回答1件
あなたの回答
tips
プレビュー