CHttpFile网络交互功能实现...

王朝网络·vc·作者佚名  2006-01-10
宽屏版  字体: |||超大  

程序内部读取网络信息, 该代码可以通过网络提交验证密码再进行判断...

CInternetSession mySession(NULL,0);

CHttpFile* myHttpFile=NULL;

CString myData;

CString myUrl;

myUrl = "http://127.0.0.1/yanz.php?name=" + m_myName + "&password=" + m_myPassword;

myHttpFile=(CHttpFile*)mySession.OpenURL(myUrl);

while(myHttpFile->ReadString(myData))

{

m_SiteInfo = myData;

}

if( m_SiteInfo == "hao" ){

CDialog::OnCancel();

}else{

AfxMessageBox( "密码错误", NULL, MB_OK );

}

myHttpFile->Close();

mySession.Close();

-----------------------------------------------

CHttpFile Class MembersConstruction

CHttpFile

Creates a CHttpFile object.

Operations

AddRequestHeaders

Adds headers to the request sent to an HTTP server.

SendRequest

Sends a request to an HTTP server.

SendRequestEx

Sends a request to an HTTP server using the Write or WriteString methods of CInternetFile.

EndRequest

Ends a request sent to an HTTP server with the SendRequestEx member function.

QueryInfo

Returns the response or request headers from the HTTP server.

QueryInfoStatusCode

Retrieves the status code associated with an HTTP request and places it in the supplied dwStatusCode parameter.

GetVerb

Gets the verb that was used in a request to an HTTP server.

GetObject

Gets the target object of the verb in a request to an HTTP server.

GetFileURL

Gets the URL for the specified file.

Close

Closes the CHttpFile and frees its resources.

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
© 2005- 王朝网络 版权所有