I have a very diverse script that makes a GET http call in objective c, but in return I receive a 403 Forbidden error server-side…
My objective c code…
NSString *result = (__bridge NSString *) CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault, (__bridge CFStringRef)videoURL, NULL, CFSTR(":/?#[]@!$&’()*+,;="), kCFStringEncodingUTF8);
NSString *urlString = [NSString stringWithFormat:@"http://www.webprogramming360.com/VideoPush/plist/urlTrans.php?videoID=%@",result];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:urlString]];
NSURLConnection *connect = [[NSURLConnection alloc] initWithRequest:request delegate:self];
if(connect) {
NSLog(@"Successful! =----= %d",[result length]);
} else {
NSLog(@"Failure");
}
It’s very simple and it actually works if you change the urlString object to this…
NSString *urlString = [NSString stringWithFormat:@"http://www.webprogramming360.com/VideoPush/plist/urlTrans.php?videoID=1"];
But the code doesn’t work the other way… Why?
Try this: