Can NSURL setup a POST method ?
29/10/03 10:36
If no, how to do this ?
A POST request can be sent using NSURLHandle writeData method.
You still have to construct the POST data:
POST path_to_handler_on_server HTTP/1.0
Content-type: application/x-www-form-urlencoded
Content-length: size_in_bytes_of my_url_encoded_data
my_url_encoded_data
Note that each line terminates with a newline character and the blank line after the Content-length header.
You can build the content using classic NSString methods and convert the resulting string into an NSData object with dataUsingEncoding.
You should also take a look at the Apple example on your hard disk: /Developer/Examples/Networking/POST Example mixing Foundation and CoreFoundation calls to do the job.
You still have to construct the POST data:
POST path_to_handler_on_server HTTP/1.0
Content-type: application/x-www-form-urlencoded
Content-length: size_in_bytes_of my_url_encoded_data
my_url_encoded_data
Note that each line terminates with a newline character and the blank line after the Content-length header.
You can build the content using classic NSString methods and convert the resulting string into an NSData object with dataUsingEncoding.
You should also take a look at the Apple example on your hard disk: /Developer/Examples/Networking/POST Example mixing Foundation and CoreFoundation calls to do the job.