symbian 使用http get post方式获取网页信息
2010-05-31 19:38:00 来源:WEB开发网核心提示:CClientEngine::~CClientEngine() // // Destructor. // CClientEngine::~CClientEngine() { iSession.Close(); // and finally close handles iConnection.Close(); iSoc
CClientEngine::~CClientEngine() // // Destructor. //
----------------------------------------------------------------------------
CClientEngine::~CClientEngine() { iSession.Close(); // and finally close handles
iConnection.Close(); iSocketServ.Close(); delete iPostData; } //
---------------------------------------------------------------------------- //
CClientEngine::ConstructL() // // Second phase construction. //
----------------------------------------------------------------------------
void CClientEngine::ConstructL() { // Open RHTTPSession with default protocol
("HTTP/TCP") TRAPD(err, iSession.OpenL()); if(err != KErrNone) { // Most common
error; no access point configured, and session creation // leaves with
KErrNotFound. _LIT(KErrMsg, "Cannot create session. Is internet access point
configured?"); _LIT(KExitingApp, "Exiting app."); CEikonEnv::Static()-
>InfoWinL(KErrMsg, KExitingApp); User::Leave(err); } // Install this class as
the callback for authentication requests. When // page requires authentication
the framework calls GetCredentialsL to get // user name and password.
InstallAuthenticationL(iSession); } //
---------------------------------------------------------------------------- //
CClientEngine::SetHeaderL() // // Used to set header value to HTTP request //
----------------------------------------------------------------------------
void CClientEngine::SetHeaderL(RHTTPHeaders aHeaders,//设置一个http包头 TInt
aHdrField, const TDesC8& aHdrValue) { RStringF valStr =
iSession.StringPool().OpenFStringL(aHdrValue); CleanupClosePushL(valStr);
THTTPHdrVal val(valStr);
aHeaders.SetFieldL(iSession.StringPool().StringF(aHdrField,
RHTTPSession::GetTable()), val); CleanupStack::PopAndDestroy(); // valStr } //
---------------------------------------------------------------------------- //
CClientEngine::IssueHTTPGetL() // // Start a new HTTP GET transaction. //
----------------------------------------------------------------------------
更多精彩
赞助商链接