BOOL ret = FALSE ;
CString strData = 。。。 ; // 要POST的内容
try
{
CInternetSession Session ;
CHttpConnection *pHttpConnect = Session.GetHttpConnection( _T("www.abc.com") ) ;
if( pHttpConnect )
{
CHttpFile* pFile = pHttpConnect->OpenRequest( CHttpConnection::HTTP_VERB_POST, _T("/data/form.asp"));
if ( pFile )
{
CString strHead = _T("Content-Type: application/x-www-form-urlencoded") ;
ret = pFile->SendRequest( strHead ,
(LPVOID)(LPCTSTR)strData , strData.GetLength() );
pFile->Close();
delete pFile ;
}
pHttpConnect->Close() ;
delete pHttpConnect ;
}
}
catch( CInternetException *e )
{
e->Delete();
}
return ret ;