Hi, I recently did the same thing and here is how I got it to work. I would get the string from a UIText Field like this:
Code:
NSString *passwordstring=password.text; NSString *usernamestring=username.text;
After I had the string I would send it up to the server like this:
Code:
NSString *url = [ NSString stringWithFormat: @"http://test.com/Login.php?user=%@&pass=%@", usernamestring, passwordstring];
NSString *escapedURL = [url stringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding];
NSString *webpage = [NSString stringWithContentsOfURL:[NSURL URLWithString:escapedURL]];
and retrieve a string back (that was echoed from the PHP script) from the server saying "YES" or "NO". If it was "YES", i would go to the next page. Like this:
Code:
if([webpage isEqualToString: @"YES"]){
//do the funciton [self presentModalViewetc.....];
}
My php for the login system was a mysql database. I got the username and password in the php script by saying
Code:
$username = $_GET['user'];
$password = $_GET['pass'];
The rest you should know, If you have any more questions just ask me.
Cheers,
George