本文为您提供了Objective-C语言版本的提交查询接口对接DEMO示例
#import <Foundation/Foundation.h>
// 简单的HTTP POST请求示例
void sendSimplePostRequest() {
// 创建URL
NSURL *url = [NSURL URLWithString:@"https://api.ihuyi.com/idcard/entfuz/Submit.json"];
// 创建请求
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
[request setHTTPMethod:@"POST"];
[request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"];
// 准备表单数据
NSString *postString = @"account=xxxxxxxx&password=xxxxxxxxx&ent_name=上海************有限公司&page_index=1&page_size=20&time=1623643787&";
NSData *postData = [postString dataUsingEncoding:NSUTF8StringEncoding];
[request setHTTPBody:postData];
// 发送请求
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *task = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"错误: %@", error.localizedDescription);
return;
}
NSString *responseString = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
NSLog(@"响应: %@", responseString);
}];
[task resume];
}
int main(int argc, const char * argv[]) {
@autoreleasepool {
NSLog(@"发送请求...");
sendSimplePostRequest();
// 等待请求完成
[[NSRunLoop currentRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:3]];
}
return 0;
}
国内专业互联网团队
21年行业经验
7x24小时售后支持
丰富的行业经验
Copyright © 2004-2025 上海思锐信息技术有限公司 All rights reserved. 沪ICP备07035915号-15 电信增值业务许可证:B2-20160082
服务热线:
4008 808 898
服务热线(工作时间):
4008 808 898
业务咨询(非工作时间):
售后咨询(非工作时间):