标签:
//创建网址字符串对象
NSString *urlStr = [NSString stringWithFormat:@"http://api.tudou.com/v3/gw"];
//创建URL对象
NSURL *url = [NSURL URLWithString:urlStr];
//创建请求对象
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
//创建参数字符串
NSString *parmStr = [NSString stringWithFormat:@"method=album.channel.get&appKey=myKey&format=json&channel=t&pageNo=1&pageSize=10"];
//设置请求体 (提交的内容)
NSData *data = [parmStr dataUsingEncoding:NSUTF8StringEncoding];
[request setHTTPBody:data];
//设置请求方式
[request setHTTPMethod:@"POST"];
//创建连接
//同步
NSData *data1 = [NSURLConnection sendSynchronousRequest:request returningResponse:nil error:nil];
[self analysisData:data1];
标签:
原文地址:http://www.cnblogs.com/tapple/p/4819168.html