求助:HttpOpenRequest返回错误 错误码12006

tianshui2014 2015-03-16 02:18:38
在网上查不到相关的解决方法 求各位指点一下 下面是我的代码
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;
}
...全文
1006 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
tianshui2014 2015-03-16
  • 打赏
  • 举报
回复
引用 1 楼 mxway 的回复:
HttpOpenRequest()的返回值也就是win32的GetLastError的返回值,GetLastError返回值12006对应的描述信息为 The URL scheme could not be recognized, or is not supported.
谢谢,已经解决 是自己太粗心了
mxway 2015-03-16
  • 打赏
  • 举报
回复
检查你传的url是否正确。
mxway 2015-03-16
  • 打赏
  • 举报
回复
HttpOpenRequest()的返回值也就是win32的GetLastError的返回值,GetLastError返回值12006对应的描述信息为 The URL scheme could not be recognized, or is not supported.

3,881

社区成员

发帖
与我相关
我的任务
社区描述
C/C++ 其它技术问题
社区管理员
  • 其它技术问题社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧