symbian 使用http get post方式获取网页信息
2010-05-31 19:38:00 来源:WEB开发网148. SetHeaderL(hdr, HTTP::EUserAgent, KUserAgent);
149. SetHeaderL(hdr, HTTP::EAccept, KAccept);
150. // Submit the transaction. After this the framework will give transaction
151. // events via MHFRunL and MHFRunError.
152. iTransaction.SubmitL();//调用 MHFRunL
153. iRunning = ETrue;
154. _LIT(KConnecting,"Connecting...");
155. iObserver.ClientEvent(KConnecting);
156. }
157.
158. // ----------------------------------------------------------------------------
159. // CClientEngine::IssueHTTPPostL()
160. //
161. // Start a new HTTP POST transaction.
162. // ----------------------------------------------------------------------------
163. void CClientEngine::IssueHTTPPostL(const TDesC8& aUri,
164. const TDesC8& aContentType,
165. const TDesC8& aBody)
166. {
167. SetupConnectionL();
168.
169. // Parse string to URI
170. TUriParser8 uri;
171. uri.Parse(aUri);
172. // Copy data to be posted into member variable; iPostData is used later in
173. // methods inherited from MHTTPDataSupplier.
174. delete iPostData;
175. iPostData = aBody.AllocL();//把取得的数据放到iPostData里
176. // Get request method string for HTTP POST
177. RStringF method = iSession.StringPool().StringF(HTTP::EPOST,//设置post方法
178. RHTTPSession::GetTable());
179. // Open transaction with previous method and parsed uri. This class will
180. // receive transaction events in MHFRunL and MHFRunError.
181. iTransaction = iSession.OpenTransactionL(uri, *this, method);
182. // Set headers for request; user agent, accepted content type and body's
183. // content type.
更多精彩
赞助商链接