I’m an iPhone Developer, and I’ve recently got into PHP.
On a website that I’ve recently done for someone, I made a feedback form. This submits the data to a PHP file via POST, and then my PHP codes saves it to the MySQL database. The person I made the site for can then view it on a CMS I made for them.
That’s all great (and I have no problem with the PHP), but what if I wanted to do it from an iphone app (directly to the server)?
Would you make a GET request like so: http://www.mysite.com/app_data/submit_feedback.php?api_key=somekey&name=somename&email=someemail&feedback=lots%20of%20characters%20with%lots%20of%20escapes%20in
Or is it possible to submit POST data from the iPhone? Should I use ASIHTTPRequest? Or should I package the data in XML/JSON and have it upload the file somehow?
I would appreciate any advice on this issue.
You could use ASIHttpRequest, or use the standard API NSURLConnection and NSMutableURLRequest.
You can submit POST using NSMutableURLRequest:
I could go on and provide a full example, but you should just look at apples example
http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/URLLoadingSystem/Tasks/UsingNSURLConnection.html