views:

178

answers:

1

How you get web page data and set the data to string ?

somthing like :

NSString *str = GetWebPageData("www.mysite.com/webpage.html");

in the str, i will see "html my web page html" for example

+3  A: 

This code is taken from my StackApp project:

NSString *url = @"http://www.example.com";
NSURL *urlRequest = [NSURL URLWithString:url];
NSError *err = nil;

NSString *html = [NSString stringWithContentsOfURL:urlrequest encoding:NSUTF8StringEncoding error:&err];

if(err)
{
    //Handle error...
}
rjstelling