网络编程测试用例
来源:互联网 发布:游戏脚本软件 编辑:程序博客网 时间:2024/06/09 13:47
-(void)myPostMethod
NSURL *url = [NSURL URLWithString:@"http://app.chaojiankang.com/client/expertLogin.do"];
//// /
NSMutableURLRequest *request = [[NSMutableURLRequest alloc]initWithURL:url cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:10];
[request setHTTPMethod:@"POST"];//设置请求方式为POST,默认为GET
NSString *push_id=[NSString stringWithFormat:@"act=exp_test&pwd=exp_test"];//设置参数
NSData *data = [push_id dataUsingEncoding:NSUTF8StringEncoding];
[request setHTTPBody:data];
//
//
NSData *received = [NSURLConnection sendSynchronousRequest:request returningResponse:nil error:nil];
{
第一步:拼串
第二部:url连接
第三步:NSMutableURLRequest请求url。
第三步半:setHTTPMethod:设置请求方式(默认是get)
第四步:NSData 转码dataUsingEncoding:NSUTF8StringEncoding
第五步:设置setHTTPBody
第六部:NSURLConnection开辟同步请求方式
/* post method */NSURL *url = [NSURL URLWithString:@"http://app.chaojiankang.com/client/expertLogin.do"];
//// /
NSMutableURLRequest *request = [[NSMutableURLRequest alloc]initWithURL:url cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:10];
[request setHTTPMethod:@"POST"];//设置请求方式为POST,默认为GET
NSString *push_id=[NSString stringWithFormat:@"act=exp_test&pwd=exp_test"];//设置参数
NSData *data = [push_id dataUsingEncoding:NSUTF8StringEncoding];
[request setHTTPBody:data];
//
//
NSData *received = [NSURLConnection sendSynchronousRequest:request returningResponse:nil error:nil];
NSString *str1 = [[NSString alloc]initWithData:received encoding:NSUTF8StringEncoding];
}
0 0
- 网络编程测试用例
- 网络编程:gethostbyname()测试程序
- 《UNIX网络编程》daytimetcpcli测试
- 发布NetWay网络编程引擎测试版。
- Python 网络编程测试-socket初探
- python 网络编程测试-host应答
- python网络编程测试-broadcast
- Python网络编程测试-DNS
- Python 网络编程测试-HTML解析
- Python 网络编程测试-Parser初探
- Python 网络编程测试-Email初探
- UNIX 网络编程测试代码 -- UDP通信
- 测试UNIX网络编程第一个程序
- Python网络编程测试-Email初探
- 用Java测试网络代码
- 测试用网络及主机
- 一个客户端测试器(摘自《java网络编程》)
- Java编程中测试网络连通性的解决办法
- c3p0数据库连接池的使用
- Android中dp,px,sp概念梳理以及如何做到屏幕适配
- 《未解决的bug》android开发:按钮直接拨打电话小米不行,华为可以
- jquery tablesorter对表格进行排序
- 利用循环结构求和do while语句
- 网络编程测试用例
- 技术笔记2_ASP.net:母版页中尽量不要调用DataBind
- Oracle带输入、输出参数的存储过程 返回受影响的行数 SQL%ROWCOUNT
- Jetty 使用 以及HTML 和Js代码无法保存问题解决
- 让你的Java 程序跑的更快
- 高性能JSON库---FastJson(阿里巴巴)
- GLView基本分析
- android快速开发框架
- XUtils