was anybody successful in creating a POST request to be submitted to mobile safari? i feel like i'm doing the right thing, yet the server receives a GET instead of a POST.
my showpost.php test page is set to display the request method, the headers, and all this background stuff. it shows as it received a GET. i unsuccessfully tried adding data to the request body, forcing the content-type header to look like the request comes in from an html form, and PUT for the sake of it. do POST requests at least work with NSURLConnections, in your experience?
thanks everybody.
Code:
#define BASE_URL @"http://m.someserver.com"
// create url object
NSString *urlString; NSURL *url;
urlString = [NSString stringWithFormat: @"%@/showpost.php", BASE_URL];
url = [NSURL URLWithString: urlString];
// create the request
NSMutableURLRequest *postRq = [NSMutableURLRequest requestWithURL: url];
[postRq setHTTPMethod: @"POST"];
NSLog(@"method: %@", [postRq HTTPMethod]);
// call safari with the url thus built
[[UIApplication sharedApplication] openURL: url];
my showpost.php test page is set to display the request method, the headers, and all this background stuff. it shows as it received a GET. i unsuccessfully tried adding data to the request body, forcing the content-type header to look like the request comes in from an html form, and PUT for the sake of it. do POST requests at least work with NSURLConnections, in your experience?
thanks everybody.