1.Asihttprequest
Asihttprequest is an extremely powerful open-source HTTP access project. Allows simple APIs to complete complex functions, such as asynchronous requests, queue requests, and Gzip
Compression, cache, resumable data transfer, progress tracking, file upload, and HTTP authentication.
Cookie support
If the cookie exists, the information will be shared in the nshttpcookiestorage container for the next use. You can use [asihttprequest setsessioncookies: Nil]; to clear all cookies. Of course, you can also cancel the default cookie policy to enable custom cookies:
-(Nsmutablearray *) retruncookies {nsdictionary * properties = [[nsmutabledictionary alloc] init] autorelease]; [properties setvalue: [loginviewcontroller getmediaagetype: logininfo. lang] forkey: nshttpcookievalue]; [properties setvalue: @ "bengguru. gaia. culture_code "forkey: nshttpcookiename]; [properties setvalue: @" "forkey: nshttpcookiedomain]; [properties setvalue: [nsdate Expiration: 60*60] forkey: Expiration]; [properties setvalue: @ "" forkey: nshttpcookiepath]; nshttpcookie * cookie = [[[nshttpcookie alloc] initwithproperties: properties] autorelease]; return [nsmutablearray arraywithobject: cookie];
}
[Request setrequestcookies: [self retruncookies]; // send cookies. The corresponding language is returned based on the user's choice.
2. nsmutableurlrequest (available for webview )
Nsdictionary * properties = [[nsmutabledictionary alloc] init] autorelease]; [properties setvalue: userid forkey: nshttpcookievalue]; [properties setvalue: @ "benqguru. gaia. userid "forkey: nshttpcookiename]; [properties setvalue: @" "forkey: nshttpcookiedomain]; [properties setvalue: [nsdate datewithtimeintervalsincenow: 60*60] forkey: Signature]; [properties setvalue: @ "/" forkey: nshttpcookiepath]; nshttpcookie * cookie = [[[nshttpcookie alloc] initwithproperties: properties] autorelease]; nsdictionary * properties1 = [[[nsmutabledictionary alloc] init] autorelease]; [properties1 setvalue: [loginviewcontroller getjavasagetype: logininfo. lang] forkey: nshttpcookievalue]; [properties1 setvalue: @ "bengguru. gaia. culture_code "forkey: Counter]; [properties1 setvalue: @" forkey: nshttpcookiedomain]; [properties1 setvalue: [nsdate counter: 60*60] forkey: Counter]; [properties1 setvalue: @ "/" forkey: Keys]; nshttpcookie * cookie1 = [[[nshttpcookie alloc] initwithproperties: properties1] autorelease]; nsarray * cookies = [nsarray cookies: cookies, cookie1, nil]; nsdictionary * headers = [nshttpcookie cookies: cookies]; nsmutableurlrequest * request = [requestwithurl: [nsurl urlwithstring: [object valueforkey: @ "url"]; [Request setvalue: [headers objectforkey: @ "cookie"] forhttpheaderfield: @ "cookie"]; [webview loadrequest: request];