symbian 使用http get post方式获取网页信息
2010-05-31 19:38:00 来源:WEB开发网184. RHTTPHeaders hdr = iTransaction.Request().GetHeaderCollection();
185. SetHeaderL(hdr, HTTP::EUserAgent, KUserAgent);
186. SetHeaderL(hdr, HTTP::EAccept, KAccept);
187. SetHeaderL(hdr, HTTP::EContentType, aContentType);
188. // Set this class as an data supplier. Inherited MHTTPDataSupplier methods
189. // are called when framework needs to send body data.
190. MHTTPDataSupplier* dataSupplier = this;
191. iTransaction.Request().SetBody(*dataSupplier);//设置提交的数据
192. // Submit the transaction. After this the framework will give transaction
193. // events via MHFRunL and MHFRunError.
194. iTransaction.SubmitL();
195. iRunning = ETrue;
196. _LIT(KConnecting,"Connecting...");
197. iObserver.ClientEvent(KConnecting);
198. }
199. // ----------------------------------------------------------------------------
200. // CClientEngine::CancelTransaction()
201. //
202. // Cancels currently running transaction and frees resources related to it.
203. // ----------------------------------------------------------------------------
204. void CClientEngine::CancelTransaction()
205. {
206. if(!iRunning)
207. return;
208. // Close() also cancels transaction (Cancel() can also be used but
209. // resources allocated by transaction must be still freed with Close())
210. iTransaction.Close();
211. // Not running anymore
212. iRunning = EFalse;
213. _LIT(KTransactionCancelled, "Transaction cancelled");
214. iObserver.ClientEvent(KTransactionCancelled);
215. }
216.
217. // ----------------------------------------------------------------------------
218. // CClientEngine::MHFRunL()
更多精彩
赞助商链接