ios网络请求Content-Type为application/x-www-form-urlencoded
来源:互联网 发布:如何启动mysql 编辑:程序博客网 时间:2024/06/05 01:01
ios网络请求Content-Type为application/x-www-form-urlencoded
by 伍雪颖
NSHTTPURLResponse *response = nil; NSError *error = nil; NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString:@"http://115.28.131.98:83/auth"]]; request.HTTPMethod = @"POST"; [request addValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"]; NSString *postStr = [NSString stringWithFormat:@"useremail=%@&password=%@",_emailTextfield.text,[WTMd5Encoding md5:_passwordTextfield.text]]; [request setHTTPBody:[postStr dataUsingEncoding:NSUTF8StringEncoding]]; NSData *respData = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&error]; NSLog(@"%d-%@", [response statusCode],[NSString stringWithUTF8String:[respData bytes]]); if ([response statusCode] == 200) { dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ [self pushToMainPage:nil]; }); } NSHTTPURLResponse *response = nil; NSError *error = nil; NSMutableURLRequest *postRequest = [[AFHTTPRequestSerializer serializer] requestWithMethod:@"POST" URLString:@"http://115.28.131.98:83/auth" parameters:@{@"useremail": _emailTextfield.text,@"password":[WTMd5Encoding md5:_passwordTextfield.text]} error:&error]; NSData *respData = [NSURLConnection sendSynchronousRequest:postRequest returningResponse:&response error:&error]; NSLog(@"%d-%@", [response statusCode],[NSString stringWithUTF8String:[respData bytes]]); if ([response statusCode] == 200) { dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ [self pushToMainPage:nil]; }); }
0 0
- ios网络请求Content-Type为application/x-www-form-urlencoded
- Content-Type: application/x-www-form-urlencoded
- [转]Content-Type: application/x-www-form-urlencoded
- Content-Type: application/x-www-form-urlencoded什么意思
- 关于 Content-Type:application/x-www-form-urlencoded
- 关于 Content-Type:application/x-www-form-urlencoded 和 Content-Type:multipart/related
- 关于 Content-Type:application/x-www-form-urlencoded 和 Content-Type:multipart/related
- 关于 Content-Type:application/x-www-form-urlencoded 和 Content-Type:multipart/related
- 关于 Content-Type:application/x-www-form-urlencoded 和 Content-Type:multipart/related
- 关于 Content-Type:application/x-www-form-urlencoded 和 Content-Type:multipart/related
- Content-Type:application/x-www-form-urlencoded 和 Content-Type:multipart/rel
- 关于 Content-Type:application/x-www-form-urlencoded 和 Content-Type:multipart/rel (2
- 关于 Content-Type:application/x-www-form-urlencoded 和 Content-Type:multipart/related
- 关于 Content-Type:application/x-www-form-urlencoded 和 Content-Type:multipart/related
- 关于 Content-Type:application/x-www-form-urlencoded 和 Content-Type:multipart/related
- Content-Type:application/x-www-form-urlencoded 和 multipart/form-data
- elasticsearch6.x {"error":"Content-Type header [application/x-www-form-urlencoded] is not supported"
- 解决Content-Type :application/x-www-form-urlencoded 老是request.getInputStream()取不到值的问题
- HDU1874畅通工程续
- 师兄面试总结编程部分解答之四
- ajax post 提交中文java后台获取参数出现乱码解决方法
- 在一家创业性的互联网公司面试经历(包含面试题)
- 金庸武侠小说之我的见解
- ios网络请求Content-Type为application/x-www-form-urlencoded
- 实例学习gcc+gdb+make
- 学习笔记(一) HTML+CSS基础课程
- 改变世界的17个等式
- UVaLIve 2889 | LA 2889 | UVa 12050 - Palindrome Numbers (组合数学)
- 二分查找
- java中接口的妙用(一)
- 滤波器设计指标
- 我的IT成长之旅