Reputation: 2351
I have been trying to access the pls file data from shoutcast for some testing but the response seems to be forbidden and I am getting 403 as response. here is the code
NSURL *myurl = [NSURL URLWithString:@"http://yp.shoutcast.com/sbin/tunein-station.pls?id=9944"] ;
//Accept:*/*
NSMutableURLRequest *myrequest = [[NSMutableURLRequest alloc]initWithURL:myurl];
[myrequest setValue:@"*/*" forHTTPHeaderField:@"Accept"];
//NSURL *myurl = [NSURL URLWithString:@"http://www.google.com"];
NSURLConnection *theConnection = [[NSURLConnection alloc]initWithRequest:myrequest delegate:self];
On the response, it was showing a 403 and no data is received. I tried to check the content-type and it was showing audio/x-scpls
Upvotes: 1
Views: 528
Reputation: 3321
In case of disallowing NSURLRequests, changing the submitted user agent should avoid the 403 response:
[myRequest setValue:userAgent forHTTPHeaderField:@"useragent"];
Upvotes: 3