Skip navigation.
 
mlRe: Best Way to Replicate CURL in Cocoa?
FROM : Jens Alfke
DATE : Tue Apr 01 17:51:39 2008

On 1 Apr '08, at 5:39 AM, Brad Gibbs wrote:

> Given this, I'm suspecting it responds to HTTP Posts, rather than 
> XML-RPC or SOAP requests.


But both those protocols do use HTTP POSTs. (XML-RPC can use alternate 
transports, but in practice it's almost always over HTTP.)

> I've seen references to a Cocoa wrapper for curl, but they're from 
> 2002.  Looking through Apple's documentation for a more up-to-date 
> method for sending HTTP Posts, it appears that I could make HTTP 
> Posts from CFNetwork (CFHTTPMessage with a POST method) or through 
> NSURLRequest.


Pretty much every Cocoa app that does HTTP uses NSURLRequest. It's 
definitely the way to go for what you're doing. Create a mutable one, 
then use its HTTP-specific setters to configure the method and headers 
and set a body.

—Jens

Related mailsAuthorDate
mlBest Way to Replicate CURL in Cocoa? Brad Gibbs Apr 1, 14:39
mlRe: Best Way to Replicate CURL in Cocoa? Jens Alfke Apr 1, 17:51
mlRe: Best Way to Replicate CURL in Cocoa? Brad Gibbs Apr 1, 18:03