开发者

loading HTML data in iPhone sdk?

I want to get HTML data from a website. How can I do that? I have tried html parser but it fails (it keeps crashing my application using hpple).. so what can I do to load data from a web page like specific strings from a web page? is loadHTM开发者_如何学PythonLString a good choice (any tutorials on this would be help ful too)

thanks,

TC


I recommend using ASIHTTPRequest library For example just to load a web page you can write:

- (IBAction)grabURL:(id)sender
{
  NSURL *url = [NSURL URLWithString:@"http://allseeing-i.com"];
  ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url];
  [request startSynchronous];
  NSError *error = [request error];
  if (!error) {
    NSString *response = [request responseString];
  }
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜