• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: How to do an HTTP POST in Cocoa
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to do an HTTP POST in Cocoa


  • Subject: Re: How to do an HTTP POST in Cocoa
  • From: "Nick Kreeger" <email@hidden>
  • Date: Sat, 10 Jun 2006 12:54:17 -0500

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@hidden> 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@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >How to do an HTTP POST in Cocoa (From: Graham <email@hidden>)

  • Prev by Date: Re: Rounding off numbers
  • Next by Date: setAltIncrement on NSSlider
  • Previous by thread: Re: How to do an HTTP POST in Cocoa
  • Next by thread: Cocoa newb - Bus Error from TCP Server
  • Index(es):
    • Date
    • Thread