iOS x-www-form-urlencoded格式传参
来源:互联网 发布:算法精解 java 编辑:程序博客网 时间:2024/06/06 00:18
NSURL *url=[[NSURLalloc]initWithString:@"http://www.musems.com/index.php/survey"];
NSMutableData *postBody=[NSMutableDatadata];
[postBody appendData:[@"date=2016-01-11&time=04:46&location=LOCATION35&name=NAME&a1=1&a2=2&a3=2&a3_remark=a3_remark&a4=1&a5=2&a6=2&a7=1&a8=a8&a9=a9&password=musesurvey&activity_type=KA&product_name1=sdg&product_name2=dg"dataUsingEncoding:NSUTF8StringEncoding]];
NSMutableURLRequest *request=[[NSMutableURLRequestalloc]initWithURL:url
cachePolicy:NSURLRequestReloadIgnoringCacheData
timeoutInterval:20.0f];
[requestsetHTTPMethod: @"POST"];
[request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"];
[requestsetHTTPBody:postBody];
NSError *error = nil;
NSHTTPURLResponse* urlResponse = nil;
NSData *responseData = [NSURLConnectionsendSynchronousRequest:request
returningResponse:&urlResponse error:&error];
NSString *result = [[NSStringalloc] initWithData:responseData
encoding:NSUTF8StringEncoding];
NSLog(@"结果:%@",result);
- iOS x-www-form-urlencoded格式传参
- application/x-www-form-urlencoded
- application/x-www-form-urlencoded
- application/x-www-form-urlencoded
- application/x-www-form-urlencoded
- application/x-www-form-urlencoded
- application/x-www-form-urlencoded
- application/x-www-form-urlencoded
- x-www-form-urlencoded 陷阱
- application/x-www-form-urlencoded
- application/x-www-form-urlencoded
- application/x-www-form-urlencoded
- application/x-www-form-urlencoded
- Form元素application/x-www-form-urlencoded
- x-www-form-urlencoded multipart/form-data
- angular2 post以“application/x-www-form-urlencoded”形式传参的解决办法
- application/x-www-form-urlencoded 字符编码
- Content-Type: application/x-www-form-urlencoded
- onPrepareOptionsMenu 和onCreateOptionsMenu 的区别
- folder汇总字段的实现
- Spring4.2第一个小例子
- 从零开始搭建架构实施Android项目
- NFC技术的基础应用
- iOS x-www-form-urlencoded格式传参
- 初识类
- 12、String类
- gedit中文乱码问题
- 最大子序列和问题
- 近200篇机器学习&深度学习资料分享
- Android 如何从系统图库中选择图片
- hadoop常用算法简单实例
- Spring mvc常用注解