I’ve got an URL like here. When I type that into Safari’s address bar I see an result like “Error” or “OK”.
So, how do I properly call that URL from within my code and get that result as a string?
I’ve tried it with NSURLConnection, NSURLRequest and NSURLResponse but my response object is always nil.
The “response” in those classes refers to the protocol response (HTTP headers, etc.), not the content.
To get the content, you have a few options:
Use NSURLConnection in synchronous mode:
Use
[NSString stringWithContentsOfURL:]Of course, you should use options 2 and 3 only if your content will be really small in size, to maintain responsiveness.