Created
September 9, 2009 06:28
-
-
Save atnan/183517 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <Foundation/Foundation.h> | |
int main(void) { | |
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; | |
NSURL* url = [NSURL URLWithString:@"https://twitter.com/"]; | |
NSMutableURLRequest* request = [NSMutableURLRequest requestWithURL:url]; | |
[request setHTTPMethod:@"HEAD"]; | |
NSHTTPURLResponse* response; | |
NSError* error; | |
[NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&error]; | |
if (error != nil || [response statusCode] != 200) { | |
NSLog(@"FAIL! (error = %@, status code = %i)", error, [response statusCode]); | |
} else { | |
NSLog(@"SUCCESS!"); | |
} | |
[pool release]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment