gpt4 book ai didi

c++ - 如何从 HINTERNET 获取响应 url

转载 作者:搜寻专家 更新时间:2023-10-31 01:16:56 25 4
gpt4 key购买 nike

当我像这样访问 URL 时:http://www.misslee.net/_common/inc/mi3dark_down.asp它返回到真实的 URL => http://125.141.146.184:8080/download/SetupMisslee_Dark.exe

我想我被重定向了。我想知道重定向的 URL。请帮我。如何从 HINTERNET 获取响应 url?

 TCHAR szServerName[] = _T("www.misslee.net");  
TCHAR szFormAction[] = _T("/_common/inc/mi3dark_down.asp");
TCHAR szHeader[500] = {0,};
LPCWSTR accept[2]={_T("*/*"), NULL};

DWORD_PTR dwContext=1;
BOOL bResult;
DWORD dwSize;

HINTERNET hInternet = InternetOpen( _T("HTTP-POST"), INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0 );

HINTERNET hConnect = InternetConnect( hInternet, szServerName, INTERNET_DEFAULT_HTTP_PORT, NULL, _T("HTTP/1.1"), INTERNET_SERVICE_HTTP, 0, dwContext);

HINTERNET hRequest = HttpOpenRequest( hConnect, _T("POST"), szFormAction, _T("HTTP/1.1"), NULL, accept,INTERNET_FLAG_DONT_CACHE, dwContext);

bResult = HttpSendRequest( hRequest, NULL, 0, NULL, NULL);

// Redirected response url???????????

最佳答案

InternetQueryOptionINTERNET_OPTION_URL 结合使用旗帜。

INTERNET_OPTION_URL

Retrieves a string value that contains the full URL of a downloaded resource. If the original URL contained any extra data, such as search strings or anchors, or if the call was redirected, the URL returned differs from the original. This option is valid on HINTERNET handles returned by InternetOpenUrl, FtpOpenFile, GopherOpenFile, or HttpOpenRequest. It is used by InternetQueryOption.

关于c++ - 如何从 HINTERNET 获取响应 url,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8642781/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com