I am programming the login/register functionality of my app and have everything in order so far.
When a user logins in, my php script returns a 1 if successful, and a 0 if unsuccessful. The same is true when they try to register.
My question in, how do I get my app to recognize what value is returned from the php function and respond accordingly?
- (int) authenticateClient {
NSString *loginWeb = [NSString stringWithFormat:(@"http://localhost/login.php?uname=%@&pass=%@&submit=Log%%20In"), user, pass];
NSURL *login = [NSURL URLWithString:loginWeb];
NSData *loginData = [NSData dataWithContentsOfURL: login];
NSMutableURLRequest *loginRequest = [[NSMutableURLRequest alloc] init];
[loginRequest setURL:login];
[loginRequest setTimeoutInterval:10];
It sounds like you want to create an API for your mobile app to access. In the php script you could echo back a json container for the data you want to retrieve, and have your app parse the body as json and perform whatever action necessary.