Hello,
I'm working on a network game... and well the networking part is stalling....
I have a logon UIView with a logon UIButton that starts the following action in its ViewController:
Code:
- (IBAction) login: (id) sender
{
// GUI Updates
loginIndicator.hidden = FALSE;
[loginIndicator startAnimating];
loginButton.enabled = FALSE;
// Connect to server for authentication !!! WARNING !!! this is a synchronous request, blocking
ASIFormDataRequest *request = [[[ASIFormDataRequest alloc] initWithURL:[NSURL URLWithString:@"http://www.mysecrutserver.com/cgi-bin/auth.pl"]] autorelease];
// Setup Agent
[request addRequestHeader:@"User-Agent" value:@"ASIHTTPRequest"];
[request setPostValue:usernameField.text forKey:@"user_name"];
[request setPostValue:passwordField.text forKey:@"password"];
[request start];
if ([request error])
{
// Error throw an alert ** Could not logon to game server **
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error" message:@"Could not logon to game server" delegate:nil cancelButtonTitle:@"Dismiss" otherButtonTitles:nil];
[alert show];
[alert release];
}
else if ([request responseString])
{
// A valid http request, but it the server curently does not see the post vars in the web application
NSLog (@"[DEBUG]: HTTP Response is %@",[request responseString]);
}
}
I am connecting to the Apache web server but this code does not pass the user_name or password fields to the script running there. usernameField and passwordField are variables linked to the the text fields in the login view.
Can anyone please help me? I've Googled my fingers numb and I cannot find a solution. Most every article is asking about uploading images. Forget images I'd be happy to simply pass along a few text values!
Thanks in advance!
Encryption,
Nick Powers