symbian 使用http get post方式获取网页信息
2010-05-31 19:38:00 来源:WEB开发网219. //
220. // Inherited from MHTTPTransactionCallback
221. // Called by framework to pass transaction events.
222. // ----------------------------------------------------------------------------
223. void CClientEngine::MHFRunL(RHTTPTransaction aTransaction,
224. const THTTPEvent& aEvent)
225. {
226. switch (aEvent.iStatus)
227. {
228. case THTTPEvent::EGotResponseHeaders:
229. {
230. // HTTP response headers have been received. Use
231. // aTransaction.Response() to get the response. However, it's not
232. // necessary to do anything with the response when this event occurs.
233. // Get HTTP status code from header (e.g. 200)
234. RHTTPResponse resp = aTransaction.Response();
235. TInt status = resp.StatusCode();
236. // Get status text (e.g. "OK")
237. TBuf< KStatustextBufferSize > statusText;
238. statusText.Copy(resp.StatusText().DesC());
239. TBuf< KDefaultBufferSize > text;
240. _LIT(KHeaderReceived, "Header received. Status: %d %S");
241. text.Format(KHeaderReceived, status, &statusText);
242. iObserver.ClientEvent(text);
243. }
244. break;
245. case THTTPEvent::EGotResponseBodyData:
246. {
247. // Part (or all) of response's body data received. Use
248. // aTransaction.Response().Body()- >GetNextDataPart() to get the actual
249. // body data.
250.
251. // Get the body data supplier
252. MHTTPDataSupplier* body = aTransaction.Response().Body();
253. TPtrC8 dataChunk;
254. // GetNextDataPart() returns ETrue, if the received part is the last
255. // one.
256. TBool isLast = body- >GetNextDataPart(dataChunk);
更多精彩
赞助商链接