Book Image

iOS and OS X Network Programming Cookbook

By : Jon Hoffman
Book Image

iOS and OS X Network Programming Cookbook

By: Jon Hoffman

Overview of this book

Table of Contents (15 chapters)
iOS and OS X Network Programming Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Performing HTTP(S) synchronous GET requests


In this recipe, we will create a WebServiceConnectSynchronous class that will be able to perform the HTTP GET requests. In the next recipe, Performing HTTP(S) synchronous POST requests, we will add a method to perform POST requests. If we follow the HTTP specifications to the letter, we would use the HTTP GET request to retrieve data from a server. For example, when you request a web page from a server, you submit a GET request to the server, requesting that the web page be sent to you. If you want to send information to the server, like filling out a form, you would want to submit a POST request.

For an HTTP GET request, if any parameters need to be sent to the service, they should be included in the URL. There are two primary ways to include the parameters in GET requests: