MFC从网页读取数据
1 //头文件 2 #include <afxinet.h> 3 //从url里读取数据 4 CString CWeather091001Dlg::getDataURL(CString Url) 5 { 6 CInternetSession c; 7 CHttpFile * p = NULL; 8 //打开一个URL 9 p=(CHttpFile*)c.OpenURL(Url); 10 CString str; 11 CString info; 12 while(p->ReadString(str)) //读取网页数据 13 info+=str; 14 return info; 15 }