I have been successful posting to a php file using the following code:
NSString *myRequestString = [[NSString alloc] initWithFormat
"&first=%@", number];
NSData *myRequestData = [ NSData dataWithBytes: [ myRequestString UTF8String ] length: [ myRequestString length]];
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL: [ NSURL URLWithString: @"http://awebsite.com/file.php" ]];
[ request setHTTPMethod: @"POST" ];
[ request setHTTPBody: myRequestData ];
I have also been successful loading and parsing a TableView using the following:
NSURL *url = [[NSURL alloc] initWithString
"http://awebsite.com/file.php"];
NSXMLParser *xmlParser = [[NSXMLParser alloc] initWithContentsOfURL:url];
I can't figure out how to combine the two efforts though. I would like to have my TableView updated with the contents of URL, but only after the post is complete. This way the variable sent can inform the PHP file the correct data to send back.
If you have any ideas, please advise. I appreciate it.
NSString *myRequestString = [[NSString alloc] initWithFormat
NSData *myRequestData = [ NSData dataWithBytes: [ myRequestString UTF8String ] length: [ myRequestString length]];
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL: [ NSURL URLWithString: @"http://awebsite.com/file.php" ]];
[ request setHTTPMethod: @"POST" ];
[ request setHTTPBody: myRequestData ];
I have also been successful loading and parsing a TableView using the following:
NSURL *url = [[NSURL alloc] initWithString
NSXMLParser *xmlParser = [[NSXMLParser alloc] initWithContentsOfURL:url];
I can't figure out how to combine the two efforts though. I would like to have my TableView updated with the contents of URL, but only after the post is complete. This way the variable sent can inform the PHP file the correct data to send back.
If you have any ideas, please advise. I appreciate it.