I am new to internet connection for iOS. I am trying to get data from a special site.
The following codes work perfectly with the whole site to see the data in the URL.
However, if I change it to a special site to get their data, it returns NULL !!
I think the site is somehow blocking this type of implementation. Because the site contains some XML information.
NSString *URLString = @"http://www.specialsite.com/"; NSURL *postURL = [NSURL URLWithString:URLString]; NSURLRequest *postRequest = [NSURLRequest requestWithURL:postURL]; NSURLResponse *response = nil; NSError *error = nil; NSData *responseData = [NSURLConnection sendSynchronousRequest:postRequest returningResponse:&response error:&error]; if (responseData) { NSLog(@"Response was %@", [NSString stringWithCString:[responseData bytes] encoding:NSUTF8StringEncoding]); }
Also the answer on the console:
2011-12-26 12:24:37.245 Arz[6113:207] Response was (null)
Remember, if I changed:
NSString *URLString = @"http://www.specialsite.com/";
to
NSString *URLString = @"http://www.apple.com/";
working prefect!
Sorry, I canβt name the site here (publicly).
source share