求助:HttpOpenRequest返回错误 错误码12006
在网上查不到相关的解决方法 求各位指点一下 下面是我的代码
BOOL http_operate(wstring &ws_homeurl,wstring &ws_pageurl,INTERNET_PORT port)
{
HINTERNET hinet=::InternetOpen(TEXT("anno user"),INTERNET_OPEN_TYPE_PRECONFIG,NULL,NULL,0);
if (!hinet)
{
cout<<"internet open failed....\n"<<endl;
system("pause");
return FALSE;
}
wstring wstr_user(TEXT("admin"));
wstring wstr_passwd(TEXT("admin"));
HINTERNET hconnect=::InternetConnect(hinet,ws_homeurl.c_str(),port,
wstr_user.c_str(),wstr_passwd.c_str(),INTERNET_SERVICE_HTTP,0,NULL);
if (!hconnect)
{
cout<<"internet connect error.....\n"<<endl;
system("pause");
return FALSE;
}
wchar_t wc_file_type[]={TEXT("text/*")};
HINTERNET hrequest=::HttpOpenRequest(hconnect,ws_pageurl.c_str(),TEXT("Get"),NULL,ws_homeurl.c_str(),
NULL,INTERNET_FLAG_DONT_CACHE,0);
if (!hrequest)
{
cout<<"HttpOpenRequest failed....\n"<<endl;
system("pause");
return FALSE;
}
/*
wstring ws_headers;
BOOL bresult=::HttpSendRequest(hrequest,ws_headers.c_str(),ws_headers.length(),NULL,0);
if (!bresult)
{
cout<<"HttpSendRequest failed....\n"<<endl;
return FALSE;
}
*/
return TRUE;
}