tags:

views:

28

answers:

1

I want to send a String (a long String, it's about 600 characters) to webserver (PHP webserver). Can i use NSURLRequest and NSURLConnection to send it to my PHP webserver?

+1  A: 

exactly what you are looking for

http://forums.macrumors.com/showthread.php?t=689884

NSString *params = [[NSString alloc] initWithFormat:@"foo=longstringdatagoeshere"];
[request setHTTPMethod:@"POST"];
[request setHTTPBody:[params dataUsingEncoding:NSUTF8StringEncoding]];
[[NSURLConnection alloc] initWithRequest:request delegate:self];

remember to implement the delegate methods

http://developer.apple.com/mac/library/documentation/Cocoa/Reference/Foundation/Classes/NSURLConnection_Class/Reference/Reference.html#//apple_ref/doc/uid/20001697-DontLinkElementID_17

Aaron Saunders
Thanks for your help :)
leduchuy89vn