ASIHTTPRequest和ASIFormDataRequest 区别,GET和POST
2013-11-07 12:33
573 查看
NSString *postURL = [NSString stringWithFormat:@"http://xxxxxx.php?mod=%@&data=%@", mod, data]; NSLog(@"发送注册请求URL:%@", postURL); ASIHTTPRequest *request = [[ASIHTTPRequest alloc] initWithURL:[NSURL URLWithString:postURL]]; [request startSynchronous];
如果是 Get ,或者参数可以简单的组成 Get 方式提交的时候, 比如 thread.php?id=123 , 就用 ASIHTTPRequest 就可以了
NSString *postURL = [NSString stringWithFormat:@"http://xxxxxx.php"]; ASIFormDataRequest *request = [[ASIFormDataRequest alloc] initWithURL:[NSURL URLWithString:postURL]]; [request addPostValue:myModel forKey:@"mod"]; [request addPostValue:myAllData forKey:@"data"]; [request startSynchronous];
如果必须是 POST ,或者参数很多,你要构造一个带参数的 URL 很麻烦的时候,就用 ASIHttpFormDataRequest
相关文章推荐
- 网络工程师60道典型选择题
- Cisco网络工程师和网络安全课程--免费版
- Django中HTTP请求(Request)和回应(Response)对象
- CentOS下lighttpd+php安装
- tcp为什么要三次握手,而不能二次握手?
- tcpdump使用方法
- 网络游戏服务器端开发心得之网络
- TCP/IP-------unix文件描述符-8
- nginx代码分析-http模块-access
- ubuntu 永久修改Mac地址
- TCP握手协议为什么开始需要三次结束需要四次?
- [windows网络编程]tcp/udp编程初步详解
- 网络编程中Nagle算法和Delayed ACK的测试
- 网络编程之KeepAlive vs. heart-beat
- InternetOpen/InternetOpenUrl/InternetReadFile 等相关Win32 网络API 使用详细说明
- 移动通信系统的网络优化的视频教程连载
- Socket网络编程(一)入门及UDP协议实例
- siverlight+wcf网络分房间斗地主3点选牌与拖选牌
- 将网页设置为允许 XMLHttpRequest 跨域访问
- Android中设置Ethernet为默认网络类型