首页 > 代码库 > 手机归属地查询
手机归属地查询
这两天用到手机归属地查询,之前找到一个soap的 100次/24小时 之后再继续使用就要收费。太贵了,还耽误事,后来在群里群主给推荐了一个免费的网站:
传送门
有如下功能: 截图给大家吧 只用到了其中归属地的部分 上点代码大家自行使用吧
上代码吧 :能够查询手机号的归属地,省份,等信息很全,希望能够帮到大家:
- (void)manageLocationInformation{ NSError *error; // 拼接查询字符串 NSString *locationStr = [NSString stringWithFormat:@"%@?app=phone.get&phone=%@&appkey=%@&sign=%@&format=json",kLocationBaseURL,_mobileText.text,kAPPKEY,kSIGN]; NSURL *locationURL = [NSURL URLWithString:locationStr]; NSURLRequest *request = [NSURLRequest requestWithURL:locationURL]; NSData *response = [NSURLConnection sendSynchronousRequest:request returningResponse:nil error:nil]; NSDictionary *locationManage = [NSJSONSerialization JSONObjectWithData:response options:NSJSONReadingMutableLeaves error:&error]; if (!error) { if ([[locationManage objectForKey:@"success"] integerValue] == 1) { NSDictionary *locationInfo = [locationManage objectForKey:@"result"]; // 运营商 NSString *operators = [locationInfo objectForKey:@"operators"]; // 详细信息 中国,省份,城市 NSString *informationStr = [locationInfo objectForKey:@"style_simcall"]; NSArray *informationArray = [informationStr componentsSeparatedByString:@","]; // 省份 NSString *province = informationArray[1]; // 省份-运营商 NSString *provinceManageStr = [NSString stringWithFormat:@"%@%@",province,operators]; NSLog(@";dalksjdf;las----%@",provinceManageStr); _provinceManage = provinceManageStr; } }}
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。