这要用到MFC类库
1.添加头文件 #include
2.添加代码
CString strAddress="http://www.baidu.com";
CInternetSession mySession(NULL,0);
CHttpFile* myHttpFile=NULL;
CString strsource,strline;
myHttpFile=(CHttpFile*)mySession.OpenURL(strAddress);
while(myHttpFile->ReadString(strline))
{
strsource+=strline;
strsource+="\r\n";
}
myHttpFile->Close();
mySession.Close();
strsource存储的就是html源代码。
1.读取html文件
2.字符串处理