my code here... not receive all html data....so plz reply me on it:[email protected]
NSString *get_value_key=[NSString stringWithFormat:@"personen=%@&eigenaar=%@&soortwoning=%@&beveiliging=%@&soortdak=%@",[filter_ary4 objectAtIndex:[pickerView4 selectedRowInComponent:0]],[filter_ary7 objectAtIndex:[pickerView7 selectedRowInComponent:0]],[filter_ary8 objectAtIndex:[pickerView8 selectedRowInComponent:0]],[filter_ary9 objectAtIndex:[pickerView9 selectedRowInComponent:0]],[filter_ary10 objectAtIndex:[pickerView10 selectedRowInComponent:0]]];
NSData *postData = [get_value_key dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES];
NSString *postLength = [NSString stringWithFormat:@"%lu", (unsigned long)[postData length]];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"http://media.komparu.com/inboedelverzekering/10045724/5193"]];
[request setHTTPMethod: @"POST"];
[request setValue:postLength forHTTPHeaderField:@"Content-Length"];
[request setValue:@"text/html; charset=UTF-8" forHTTPHeaderField: @"Content-Type"];
[request setHTTPBody:postData];
// NSError *requestError;
NSURLResponse *urlResponse =nil;
response1 = [NSURLConnection sendSynchronousRequest:request returningResponse:&urlResponse error:nil];
NSString *requestReply = [[NSString alloc] initWithBytes:[response1 bytes] length:[response1 length] encoding:NSASCIIStringEncoding];
NSLog(@"requestReply: %@", requestReply);
If you want the response it is in the variable: urlResponse
.
If you want the html status code cast the response to NSHTTPURLResponse
and access the statusCode
property.
Or just create NSHTTPURLResponse
instead of NSURLResponse
and access directly.
NSError *error;
NSHTTPURLResponse *urlResponse;
response1 = [NSURLConnection sendSynchronousRequest:request returningResponse:&urlResponse error:&error];
NSInteger statusCode = urlResponse.statusCode;
NSLog(@"statusCode: %i", statusCode);
if (response1) {
// process data
}
else {
// Log the response and error description
NSLog(@"urlResponse: %@", urlResponse);
NSLog(@"error: %@", error);
}
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments