Download page content

Discussion in 'Mac Programming' started by physicistjedi, Dec 12, 2008.

  1. physicistjedi macrumors newbie

    Joined:
    Jan 21, 2007
    #1
    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
     
  2. Manty macrumors member

    Joined:
    Mar 18, 2008
    Location:
    Lisbon, Portugal
    #2
    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];
     
  3. physicistjedi thread starter macrumors newbie

    Joined:
    Jan 21, 2007
    #3
    Wonderful! Just what I was looking for. Thanks!

    pj
     
  4. kainjow Moderator emeritus

    kainjow

    Joined:
    Jun 15, 2000
    #4
    If you need something that doesn't block the UI use NSURLConnection.
     

Share This Page