本文共 505 字,大约阅读时间需要 1 分钟。
//获取网页html NSURL* url = [NSURL URLWithString:@"http://www.baidu.com"]; NSMutableURLRequest* request = [NSMutableURLRequest new]; [request setURL:url]; [request setHTTPMethod:@"GET"]; NSURLRequest* response; NSData* data = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:nil]; NSString* strRet = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]; NSLog(strRet); [strRet release];
本文转自蓬莱仙羽51CTO博客,原文链接:http://blog.51cto.com/dingxiaowei/1366488,如需转载请自行联系原作者