symbian 使用http get post方式获取网页信息
2010-05-31 19:38:00 来源:WEB开发网核心提示:length in header). // TInt CClientEngine::OverallDataSize() { if(iPostData) return iPostData- >Length(); else return KErrNotFound ; } // // CClientEngine::
length in header). //
----------------------------------------------------------------------------
TInt CClientEngine::OverallDataSize() { if(iPostData) return iPostData-
>Length(); else return KErrNotFound ; } //
---------------------------------------------------------------------------- //
CClientEngine::GetCredentialsL() // // Inherited from
MHTTPAuthenticationCallback // Called by framework when we requested
authenticated page and framework // needs to know username and password. //
----------------------------------------------------------------------------
TBool CClientEngine::GetCredentialsL(const TUriC8& aURI, RString aRealm,
RStringF aAuthenticationType, RString& aUsername, RString& aPassword) {
// aURI, aReal and aAuthenticationType are informational only. We only need //
to set aUsername and aPassword and return ETrue, if aUsername and // aPassword
are provided by user. // Informational only TBuf< KURIBufferSize >
authType; TBuf< KURIBufferSize > uri; TBuf< KDefaultBufferSize >
authText; authType.Copy(aAuthenticationType.DesC()); uri.Copy(aURI.UriDes());
_LIT(KAuthRequired, "%S requires %S authentication.");
authText.Format(KAuthRequired, &uri, &authType); _LIT(KAuthNote,
"Authentication required."); CEikonEnv::Static()- >InfoWinL(KAuthNote,
authText); // Query user name and password TBuf< KDefaultBufferSize >
userName; TBuf< KDefaultBufferSize > password;
CAknMultiLineDataQueryDialog* dlg = CAknMultiLineDataQueryDialog::NewL(userName,
password); if (!dlg- >ExecuteLD(R_DIALOG_USER_PASSWORD_QUERY)) return EFalse;
// No credentials given; must return EFalse // Set aUsername and aPassword
TBuf8< KDefaultBufferSize > temp; temp.Copy(userName); TRAPD(err,
aUsername = aRealm.Pool().OpenStringL(temp)); if (!err) { temp.Copy(password);
TRAP(err, aPassword = aRealm.Pool().OpenStringL(temp)); if (!err) return ETrue;
} // Return ETrue if user has given credentials (username and password), //
更多精彩
赞助商链接