[Solved] How to get data from website


This is simple way

1) Get the html content from the url: you can use
– NSURLSession
NSURLSession *session =
[NSURLSession sessionWithConfiguration:sessionConfig
delegate:nil
delegateQueue:nil];

[[session dataTaskWithURL:[NSURL URLWithString:urlString]
        completionHandler:^(NSData *data,
                            NSURLResponse *response,
                            NSError *error) {

– NSURLConnection:

NSURLConnection *urlConnection = [[NSURLConnection alloc] initWithRequest:self.request delegate:self];
  • dataWithContentsOfURL:

    NSData * htmlData = [NSData dataWithContentsOfURL:[NSURL URLWithString:urlString]];

2) Parse the variable content from that content using TFHpple

TFHpple *xpathParser = [[TFHpple alloc] initWithHTMLData:htmlData];
NSArray *elements  = [xpathParser search:@"//variable"]; // get the variable

Hope it help

1

solved How to get data from website