Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

8. Networking, JSON, XML, and Twitter > 8.8. Sending HTTP PUT Requests with NSU...

8.8. Sending HTTP PUT Requests with NSURLConnection

Problem

You want to call a web service using the HTTP PUT method to place a resource into the web server, and perhaps pass parameters as part of the HTTP body or in the query string, to the web service.

Solution

Just as with the GET, POST, and DELETE methods, we can use the PUT method using NSURLConnection. We must explicitly set our URL’s method to PUT.

Discussion

I have set up a dummy web service at the following address: http://pixolity.com/put.php. If you open this URL in your browser, you will see something similar to the screen shown in Figure 8-5:

The PUT web service opened in a web browser

Figure 8-5. The PUT web service opened in a web browser


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial