目的是获取网站的其中一个数据:
/* CInternetSession session("Internet Explorer", 0);//创建Internet会话
CHttpFile* pHttpFile=NULL; //网页文件
m_lotteryURL="http://www.lottery.gov.cn/";
CString content,strTemp;
try
{
//获取已经打开的网页代码文件
pHttpFile = (CHttpFile*)session.OpenURL(m_lotteryURL,INTERNET_FLAG_TRANSFER_ASCII | INTERNET_FLAG_RELOAD|INTERNET_FLAG_DONT_CACHE);
}
catch (CInternetException* e)
{
e->ReportError();
delete e;
}
//一行行读取网页的内容,并组合出完整
while (pHttpFile->ReadString(strTemp))
{
content +=strTemp + TEXT("\r\n");
}
int startIndex=content.Find("index_plw_term");
strTemp=content.Mid(startIndex,256);
AfxMessageBox(strTemp);
pHttpFile->Close();
delete pHttpFile;
session.Close();
*/
但是这样获取的好像是源码,不是访问结果
相关网站:
http://www.lottery.gov.cn/