I'm having problem sending information to the PHP file at my server. I need some favor , i give up and almost can give up with this problems ahead.
IBAction:-
- (IBAction)reg:(id)sender {
NSInteger success = 0;
@try {
NSString *rawStr = [NSString stringWithFormat:@"username=%@",self.txtEmail.text];
NSData *data = [rawStr dataUsingEncoding:NSUTF8StringEncoding];
NSURL *url = [NSURL URLWithString:@"http://something.com/register.php"];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
[request setHTTPMethod:@"POST"];
[request setHTTPBody:data];
NSURLResponse *response;
NSError *err;
NSData *responseData = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&err];
NSLog(@"responseData: %@", responseData);
}
@catch (NSException * e) {
NSLog(@"Exception: %@", e);
[self alertStatus:@"Sign in Failed." :@"Error!" :0];
}
if (success) {
[self performSegueWithIdentifier:@"login_success" sender:self];
}
}
This sends to my PHP file in my server
<?php
$email = $_GET['username'];
$email2 = $_POST['username'];
mail('thepridelagoon@gmail.com','testing' , $email,$email2);
?>
I tried to test these two functions to send to my email but the email was empty for a reason. Did I went wrong?? Please help me out ty.