Skip navigation.
 
mlRe: How to do an HTTP POST in Cocoa
FROM : Nick Kreeger
DATE : Sat Jun 10 19:54:17 2006

Here is how to POST using Cocoa API's:

  NSString* content = [@"item=" stringByAppendingString:@"Something to
Post"];

  NSURL* url = [NSURL URLWithString:@"http://www.url.com/pagetopost"];
  NSMutableURLRequest* urlRequest = [[NSMutableURLRequest alloc]
initWithURL:url];
  [urlRequest setHTTPMethod:@"POST"];
  [urlRequest setHTTPBody:[content dataUsingEncoding:
NSASCIIStringEncoding]];

After this point you can do several things, such as perform the post in a
WebKit window, or read this for managing the response:

http://www.awprofessional.com/articles/article.asp?p=468381&seqNum=2&rl=1

- Kreeger

On 6/10/06, Graham <<email_removed>> wrote:
>
> Hi,
>
> I need to perform an HTTP POST to a url in my Cocoa app.
> What is the basic recipe for this in Cocoa as I can only find
> documentation on non-Cocoa classes for this?
>
> Thanks
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Cocoa-dev mailing list      (<email_removed>)
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/kreeger.<email_removed>
>
> This email sent to kreeger.<email_removed>
>

Related mailsAuthorDate
mlHow to do an HTTP POST in Cocoa Graham Jun 10, 13:37
mlRe: How to do an HTTP POST in Cocoa Paul Lynch Jun 10, 14:42
mlRe: How to do an HTTP POST in Cocoa Nick Kreeger Jun 10, 19:54