In my code I am trying to send some data to my PHP file
For adding stuff into my SQL i use the GET method.
So far I need to use a form on the website, but I'd like to add data with just browsing to it, such as:
http://server.com/add.php?user=some data here&message= last data here
I am trying to use this code so far:
NSURL *add = [NSURL URLWithString:@"http://server.com/ios/add.php?user=iPhone App&message=%@",
messageBox.text];
[messageView loadRequest:[NSURLRequest requestWithURL:add]];
However Xcode tells me: "Too many arguments to method call, expected 1, have 2"
Try this
NSString *urlString = @"http://server.com/ios/add.php?user=iPhone App&message=";
NSString *escapedString = [urlString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
NSURL *add = [NSURL URLWithString:[NSString stringWithFormat:@"%@%@",escapedString, messageBox.text]];
[messageView loadRequest:[NSURLRequest requestWithURL:add]];
You should be using NSString +stringWithFormat: