RosettaCodeData/Task/HTTP/Objective-C/http.m

18 lines
618 B
Mathematica
Raw Permalink Normal View History

2013-04-10 22:43:41 -07:00
#import <Foundation/Foundation.h>
int main (int argc, const char * argv[]) {
2014-04-02 16:56:35 +00:00
@autoreleasepool {
2013-04-10 22:43:41 -07:00
2014-04-02 16:56:35 +00:00
NSError *error;
NSURLResponse *response;
NSData *data = [NSURLConnection sendSynchronousRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://rosettacode.org"]]
returningResponse:&response
error:&error];
2013-04-10 22:43:41 -07:00
2014-04-02 16:56:35 +00:00
NSLog(@"%@", [[NSString alloc] initWithData:data
encoding:NSUTF8StringEncoding]);
2013-04-10 22:43:41 -07:00
2014-04-02 16:56:35 +00:00
}
2013-04-10 22:43:41 -07:00
return 0;
}