我想在“http://www.ceshi.com/MyTest.asp”页面上放一个变量,比如:Var(我所在的城市)=北京,如何在VC中去取这个变量Var(我所在的城市),大概怎么做?我对网络编程不熟,一点感觉都没有啊。

解决方案 »

  1.   

    用Winnet中的API可以,还有别的方法没有?
      

  2.   

    用CInternetSession也可以吧?可以得到网页源代码,如何得到那个变量的值? CInternetSession* pSession=new CInternetSession;
    CInternetFile* pFile=NULL;

    try
    {
    pFile=(CInternetFile*)pSession->OpenURL("http:////wap.tomosoft.com//um//");
    }
    catch(CInternetException* e)
    {
    //错误处理
    AfxMessageBox("网页打开失败!");
    pFile=NULL;
    e->Delete();
    } if(pFile)
    {
    //显示文件代码
    CString strLine;
    for(int i=0;pFile->ReadString(strLine);i++)
    {
    AfxMessageBox(strLine);
    }
    }
      

  3.   

    URLDownloadToFile
    然后定位就行了