开发者

ASIHTTPRequest and NSURLRequest different result

I send request to some url with ASIHTTPRequest, and always get strange response with different HTML body. If i make same request from browser or from NSURLRequest class, i get correct response with correct HTML body.

//Here is code of NSURLRequest. I'm getting correct response;
NSURLRequest *request = [NSURLRequest requestWithURL:url];
NSURLResponse *resp = nil;
NSError *err = nil;
NSData *responseData = [NSURLConnection sendSynchronousRequest: request returningResponse: &resp error: &err];
NSSt开发者_如何学Goring *theString = [[NSString alloc] initWithData:responseData encoding:NSASCIIStringEncoding];
NSLog(@"%@",theString);

//Here is code of ASIHTTPRequest. I'm getting different response. The html body is shorter than original and different;
__block ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url];
[request setCompletionBlock:^{      
    NSString *responseString = [request responseString];
}];
[request startAsynchronous];

I also tryed to send simple synchronous request with ASIHTTPRequest, but result the same. What it could be?


may be server have different logic for different request header

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜