i m using this code for posting and getting the data from the server.
NSString *post =[NSString stringWithFormat:@"any-data=%@", myData];
NSData *postData = [post dataUsingEncoding:NSUTF8StringEncoding allowLossyConversion:YES];
NSString *postLength = [NSString stringWithFormat:@"%d", [postData length]];
NSMutableURLRequest *request = [[[NSMutableURLRequest alloc] init] autorelease];
[request setURL:[NSURL URLWithString:@"http://your-server.com/your-script.php"]];
[request setHTTPMethod:@"POST"];
[request setValue:postLength forHTTPHeaderField:@"Content-Length"];
[request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"];
[request setHTTPBody:postData];
NSURLResponse *response;
NSData *urlData=[NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&error];
NSString *data=[[NSString alloc]initWithData:urlData encoding:NSUTF8StringEncoding];
NSLog(@"Data: %@",data);
but problem is that when i print data in nslog then it is in html formate
how i retrieve actual result in my application.
how parse data?
please give me if any refrence.
If you’re just scraping the HTML for data,
NSScannerwill do. If you want to display the data, a UIWebView will work. It depends on what you want to do with the HTML. You don’t need an XML parser — in most cases that’s overkill.