how to parse a website with SSL protection in Objective C
I am trying to write an application that reads in data from a website, but I am currently running into an issue due to the fact that the website is being protected by SSL, and is not possible for me to fetch the information from the website through my normal approach. Btw, this app that I am trying to write is an iph开发者_开发百科one app, so answer regarding to objective C is much appreciated. Thanks!!
First of all in ObjectiveC you can use NSURLConnection
for connecting to HTTP websites. But there is an awesome wrapper on top of this called - ASIHTTP. Try it.
Now for your specific problem of accessing SSL protected sites in ObjectiveC try this -
- To do ssl with ASIHTTPRequest, you just need to pass a https url instead of a http one.
- You don't need an real SSL certificate, you can disable validation using:
[request setValidatesSecureCertificate:NO];
- With this, you're limited by what certificate signing authorities are supported by the iphone. So long as you stick to the big names it shouldn't really be an issue. (And as per 2. you can use a self signed certificate anyway.)
- Check this for more info - http://tigelane.blogspot.com/2011/01/apple-itunes-export-restrictions-on.html
Hope this helps...
精彩评论