Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

physicistjedi

macrumors newbie
Original poster
Jan 21, 2007
27
0
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

macrumors member
Mar 18, 2008
32
0
Lisbon, Portugal
Have a look at the NSURLConnection class. If you want something even more simple use:
Code:
[NSString stringWithContentsOfURL:[NSURL URLWithString:@"http://www.yoursite.com"] encoding: NSUTF8StringEncoding error:nil];
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.