I want to pass some data from iPhone to Php. Plz, anyone can help me to solve this problem.
Thx sooooooooooooooo much =)
My situation,
Now, i created the php file(*It can send email from server, and which is work).Then, I used the Interface Builder to created the interface view in my app. So, the user can use the iphone device (*OS 3.0 or above) to input their information (for example: email address, user's name, etc.) and press the "Send" button to send the data to php. But I dont want to open the browser to view the php in iphone directly.
I want to pass some data from iPhone to Php. Plz, anyone can help me to solve this problem.
Thx sooooooooooooooo much =)
My situation,
Now, i created the php file(*It can send email from server, and which is work).Then, I used the Interface Builder to created the interface view in my app. So, the user can use the iphone device (*OS 3.0 or above) to input their information (for example: email address, user's name, etc.) and press the "Send" button to send the data to php. But I dont want to open the browser to view the php in iphone directly.
I want to pass some data from iPhone to Php. Plz, anyone can help me to solve this problem.
Thx sooooooooooooooo much =)
My situation,
Now, i created the php file(*It can send email from server, and which is work).Then, I used the Interface Builder to created the interface view in my app. So, the user can use the iphone device (*OS 3.0 or above) to input their information (for example: email address, user's name, etc.) and press the "Send" button to send the data to php. But I dont want to open the browser to view the php in iphone directly.
Sir,
I am dealing with the same problem. i have my app including some text boxes and on one click i want to store the data inputted in textfields to the PHP file present at server side
any help
Mahesh
I'm working in an application that uses .php files stored in a server. In the iPhone app user have to enter it's username and password, then send it to the server (without using Safari) and then the server returns some information in .xml format (which is received and stored by the app). This is how username and password are sent:
Code:
// check if textFields aren't empty
if (![self.txtName.text isEqualToString:@""] && ![self.txtPass.text isEqualToString:@""]) {
NSURL *url = [[NSURL alloc] initWithString:[NSString stringWithFormat:@"http://www.yourweb.com/yourfile.php?user=%@&pass=%@",self.txtName.text,self.txtPass.text]];
NSURLRequest *urlRequest = [NSURLRequest requestWithURL:url];
NSData *urlData;
NSURLResponse *response;
urlData = [NSURLConnection sendSynchronousRequest:urlRequest returningResponse:&response error:nil];
// urlData receives the returned information and then you can process
// it by storing in a temporary file and working with NSStrings
I'm working in an application that uses .php files stored in a server. In the iPhone app user have to enter it's username and password, then send it to the server (without using Safari) and then the server returns some information in .xml format (which is received and stored by the app). This is how username and password are sent:
Code:
// check if textFields aren't empty
if (![self.txtName.text isEqualToString:@""] && ![self.txtPass.text isEqualToString:@""]) {
NSURL *url = [[NSURL alloc] initWithString:[NSString stringWithFormat:@"http://www.yourweb.com/yourfile.php?user=%@&pass=%@",self.txtName.text,self.txtPass.text]];
NSURLRequest *urlRequest = [NSURLRequest requestWithURL:url];
NSData *urlData;
NSURLResponse *response;
urlData = [NSURLConnection sendSynchronousRequest:urlRequest returningResponse:&response error:nil];
// urlData receives the returned information and then you can process
// it by storing in a temporary file and working with NSStrings
Hope it helped!
hi thanks for your code it helped lots!
how could one adapt this to insert an entry to a database?
in my attempt it creates an empty row in the table.
Your php code is looking for POST data while the NSURL code above is a GET request. You have to use POST as follows :-
[NSMutableURLRequest* urlRequest = [NSMutableURLRequest requestWithURL:<your php url>];
[urlRequest setHTTPMethod:@"POST"];
[urlRequest setHTTPBody:@"var1=val1&var2=val2"]; //Replace with your actual name/parm values
[[NSURLConnection alloc] initWithRequest:urlRequest delegate:self];
Sir,
I am dealing with the same problem. i have my app including some text boxes and on one click i want to store the data inputted in textfields to the PHP file present at server side
any help
Mahesh