I have a simple task, send one variable to a php page via GET. Nothing I seem to find works, and all are seemingly more than I need.
It seems I need code to set NSURL string, NSURL request, then execute.
Can someone perhaps paste me some simple code to just execute a URL like this:
http://localhost/trendypieces/site/ios/processLatest.php?caption=yosa
Thanks!
Here's the most current iteration of something that doesn't work, seems closer though as it actually throws back the error alert. Dunno what that error is...but....
//construct an URL for your script, containing the encoded text for parameter value
NSURL* url = [NSURL URLWithString:
[NSString stringWithFormat:
@"http://localhost/trendypieces/site/ios/processLatest.php?caption=yosa"]];
NSData *dataURL = [NSData dataWithContentsOfURL:url];
NSString *serverOutput = [[NSString alloc] initWithData:dataURL encoding: NSASCIIStringEncoding];
if([serverOutput isEqualToString:@"OK"]) {
alertsuccess = [[UIAlertView alloc] initWithTitle:@"Posted" message:@"Done"
delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
} else {
alertsuccess = [[UIAlertView alloc] initWithTitle:@"Error" message:@"Done"
delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
}
[alertsuccess show];