Monday 15 February 2010

How Can I Retrieve the HTML Code for A Webpage In Swift -



How Can I Retrieve the HTML Code for A Webpage In Swift -

using swift, how can retrieve html code of webpage. have read on http requests cannot figure out how implement them fetch html code. know how this?

edit: similar question suggested not seem have working solution.

this should trick: (adapted objective-c in this answer)

let url = nsurl(string: "http://www.example.com") var error: nserror? allow html = nsstring(contentsofurl: url!, encoding: nsutf8stringencoding, error: &error) if (error != nil) { println("whoops, went wrong") } else { println(html!) }

swift

No comments:

Post a Comment