这是 PHP 代码:你需要一个带有参数 methode = getAll 的 POST 调用:
$filters = 数组(); $filters['面额'] = 'T%';
$param = array(
'type_element' => 'personne_morale',
'order' => 'denomination',
'limit' => 2,
'filtres' => $filters
);
这是我的 ios 代码,它不工作它给出错误:
NSError *error;
NSURL *url = [NSURL URLWithString: @"https://www.eden-pme.com/edensoft/edenfiles/edensoft2014/api.php"];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
NSURLResponse *response;
NSString *postString;
postString = [NSString stringWithFormat"api_public_key:api_private_key,6c8a4cf9044e48e4383b9f6a8f400055:94a337a9dd6fb58f5004f244187d5d39"];
[request setURL:url];
[request setHTTPMethod"OST"];
[request setValue:postString forHTTPHeaderField"Content-Type"];
// NSURLResponse *response;
NSData *res = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&error];
NSArray *jsonArr = [NSJSONSerialization JSONObjectWithData:res options:kNilOptions error:&error];
NSLog(@"%@",jsonArr);
试试这个,
将[request setValue:postString forHTTPHeaderField"Content-Type"];
改为
[request setHTTPBody:[postString dataUsingEncoding:NSUTF8StringEncoding]];
关于ios - 添加 curl 参数 CURLOPT_USERPWD IOS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21423078/
欢迎光临 OStack程序员社区-中国程序员成长平台 (https://ostack.cn/) | Powered by Discuz! X3.4 |