First Import the ASIHttpRequest Classes into our project.
ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:location_cookie_url];
[request setDelegate:self];
request.shouldRedirect = NO;
[request startAsynchronous];
- (void)requestFinished:(ASIHTTPRequest*)request
{
if ([[[request responseHeaders] objectForKey:@"Set-Cookie"] hasPrefix:@"Preferences"])
{
ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:current_client_url];
NSString*Strr = [NSString stringWithFormat:@"{\"IsMobile\": true, \"offerGuid\": \"%@\"}",[self.mProduct objectForKey:@"Guid"]];
NSLog(@"%@",Strr);
[request appendPostData:[Strr dataUsingEncoding:NSUTF8StringEncoding]];
[request setDelegate:self];
[request addRequestHeader:@"Content-Type" value:@"application/json; charset=utf-8"];
[request startAsynchronous];
}
}
- (void)requestFailed:(ASIHTTPRequest*)request
{
}
ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:location_cookie_url];
[request setDelegate:self];
request.shouldRedirect = NO;
[request startAsynchronous];
- (void)requestFinished:(ASIHTTPRequest*)request
{
if ([[[request responseHeaders] objectForKey:@"Set-Cookie"] hasPrefix:@"Preferences"])
{
ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:current_client_url];
NSString*Strr = [NSString stringWithFormat:@"{\"IsMobile\": true, \"offerGuid\": \"%@\"}",[self.mProduct objectForKey:@"Guid"]];
NSLog(@"%@",Strr);
[request appendPostData:[Strr dataUsingEncoding:NSUTF8StringEncoding]];
[request setDelegate:self];
[request addRequestHeader:@"Content-Type" value:@"application/json; charset=utf-8"];
[request startAsynchronous];
}
}
- (void)requestFailed:(ASIHTTPRequest*)request
{
}