View Full Version : Download page content
physicistjedi
Dec 12, 2008, 01:06 PM
I am a cocoa newbie and have simple question. I need to download a web page and get its text content. I don't need any visible browser. I guess there should be a two-line way to do it, but couldn't figure out. Every webkit example uses links to interfaces. Can somebody help?
Thank you very much
pj
Manty
Dec 12, 2008, 01:39 PM
Have a look at the NSURLConnection class. If you want something even more simple use:
[NSString stringWithContentsOfURL:[NSURL URLWithString:@"http://www.yoursite.com"] encoding: NSUTF8StringEncoding error:nil];
physicistjedi
Dec 12, 2008, 01:50 PM
Wonderful! Just what I was looking for. Thanks!
pj
kainjow
Dec 12, 2008, 02:05 PM
If you need something that doesn't block the UI use NSURLConnection.
vBulletin® v3.8.6, Copyright ©2000-2012, Jelsoft Enterprises Ltd.