1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
|
std::vector<std::string> defs;
HINTERNET c=InternetOpen("Hom's AI", INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, NULL);
HINTERNET ws=InternetConnect(c,"services.aonaware/.com",INTERNET_DEFAULT_HTTP_PORT,NULL,NULL,INTERNET_SERVICE_HTTP,0,0);
std::string rtypestr="GET";
std::string versionstr="HTTP/1.1";
const char* rtype=rtypestr.c_str();
const char* version=versionstr.c_str();
PCTSTR accept[]={"text/html", "application/xhtml+xml", "application/xml;q=0.9", "image/webp", NULL};
if(std::string::npos!=s.rfind("programming dictionary"))
{
//http://services.aonaware.com//DictService/DictService.asmx/DefineInDict?dictId=foldoc&word=
std::string word;
voce::synthesize("Input Word");
std::cout << "Input Word" << std::endl;
std::cin >> word;
std::stringstream wordstrm;
wordstrm << "//DictService/DictService.asmx/DefineInDict?dictId=foldoc&word=" << word;
std::string wordstr=wordstrm.str();
const char* wordc=wordstr.c_str();
HINTERNET h=HttpOpenRequest(ws, rtype, wordc, version, *accept, NULL, INTERNET_FLAG_CACHE_IF_NET_FAIL, 0);
BOOL res=HttpSendRequest(h, NULL, 0, NULL, 0);
ErrorExit("HSR");
if(res==true)
{
std::ofstream w;
DWORD dwBytes;
char ch;
w.open("webpage.txt");
while(InternetReadFile(h,&ch,1,&dwBytes))
{
if(dwBytes != 1)break;
w << ch;
}
w.close();
ErrorExit("IRF");
}
|