各个设备请求头设备信息User-Agent
查询网址:http://www.fynas.com/ua/search?b=&k=
伪装设置请求头部
//1.URL
NSURL *url = [NSURL URLWithString:@"https://m.baidu.com"];
//2.建立请求,告诉服务器想要的资源,已经附加信息
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
//User-Agent 告诉服务器请求的类型,发送给服务,设备的信息
[request setValue:@"iPhone AppleWebKit" forHTTPHeaderField:@"User-Agent"];
//3.建立网络连接,将请求发送给服务器
[NSURLConnection sendAsynchronousRequest:request queue:[NSOperationQueue mainQueue] completionHandler:^(NSURLResponse * _Nullable response, NSData * _Nullable data, NSError * _Nullable connectionError) { NSString *html = [[NSString alloc]initWithData:data encoding:NSUTF8StringEncoding]; [self.webView loadHTMLString:html baseURL:nil]; }];