I need to parse the response header information and handle the status code.I got the html response string now i need to do parsing how to do in iPhone?
A:
Look for the following in the documentation:
NSString componentsSeparatedByString:
NSString componentsSeparatedByCharactersInSet:
NSScanner
class
Adam Woś
2010-01-20 07:10:35
A:
If you are using NSURLConnection
for HTTP calls you can get the HTTP response code and headers from the NSURLConnectionDelegate
methods as follows:
- (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response
{
NSHTTPURLResponse* httpResponse = (NSHTTPURLResponse*)response;
NSInteger statusCode = [httpResponse statusCode];
NSDictionary* headers = [httpResponse allHeaderFields];
}
cidered
2010-01-20 13:31:52