WEB开发网
开发学院手机开发Symbian 开发 symbian 使用http get post方式获取网页信息 阅读

symbian 使用http get post方式获取网页信息

 2010-05-31 19:38:00 来源:WEB开发网   
核心提示:iTransaction = iSession.OpenTransactionL(uri, *this, method); // Set headers for request; user agent, accepted content type and body's // content type. RHTT
iTransaction = iSession.OpenTransactionL(uri, *this, method); // Set headers for request; user agent, accepted content type and body's // content type. RHTTPHeaders hdr = iTransaction.Request().GetHeaderCollection(); SetHeaderL(hdr, HTTP::EUserAgent, KUserAgent); SetHeaderL(hdr, HTTP::EAccept, KAccept); SetHeaderL(hdr, HTTP::EContentType, aContentType); // Set this class as an data supplier. Inherited MHTTPDataSupplier methods // are called when framework needs to send body data. MHTTPDataSupplier* dataSupplier = this; iTransaction.Request().SetBody(*dataSupplier);//设置提交的数据 // Submit the transaction. After this the framework will give transaction // events via MHFRunL and MHFRunError. iTransaction.SubmitL(); iRunning = ETrue; _LIT(KConnecting,"Connecting..."); iObserver.ClientEvent(KConnecting); } // ---------------------------------------------------------------------------- // CClientEngine::CancelTransaction() // // Cancels currently running transaction and frees resources related to it. // ---------------------------------------------------------------------------- void CClientEngine::CancelTransaction() { if(!iRunning) return; // Close() also cancels transaction (Cancel() can also be used but // resources allocated by transaction must be still freed with Close()) iTransaction.Close(); // Not running anymore iRunning = EFalse; _LIT(KTransactionCancelled, "Transaction cancelled"); iObserver.ClientEvent(KTransactionCancelled); } // ---------------------------------------------------------------------------- // CClientEngine::MHFRunL() // // Inherited from MHTTPTransactionCallback // Called by framework to pass transaction events. // ---------------------------------------------------------------------------- void CClientEngine::MHFRunL(RHTTPTransaction aTransaction, const THTTPEvent& aEvent) { switch (aEvent.iStatus) { case THTTPEvent::EGotResponseHeaders: { // HTTP response headers have been received. Use // aTransaction.Response() to get

上一页  13 14 15 16 17 18 19 20 21 22 23  下一页

Tags:symbian 使用 http

编辑录入:coldstar [复制链接] [打 印]
赞助商链接