// // CCHttp.h // CCFC // // Created by xichen on 11-12-21. // Copyright 2011 ccteam. All rights reserved. // #import <Foundation/Foundation.h> @interface CCHttp : NSObject { } // send a common synchronous GET request for a url, returns the recieved data + (NSData *)sendSynchronousGETRequest:(NSString *)urlStr withResponse:(NSHTTPURLResponse **)response; // send a common synchronous POST request for a url, returns the recieved data + (NSData *)sendSynchronousPOSTRequest:(NSString *)urlStr withBody:(NSData *)body withResponse:(NSHTTPURLResponse **)response; // send a common asynchronous GET request for a url + (NSURLConnection *)sendAsynchonousGETRequest:(NSString *)urlStr withDelegate:(id)delegate; // send a common asynchronous POST request for a url + (NSURLConnection *)sendAsynchonousPOSTRequest:(NSString *)urlStr withBody:(NSData *)body withDelegate:(id)delegate; + (NSString *)localizedStringForStatusCode:(int)statusCode; @end
googlecode链接地址(会有更新):http://code.google.com/p/iphone-common-codes-ccteam/source/browse/trunk/CCFC/files/CCHttp.h
github地址:https://github.com/cxsjabc/iphone-common-codes-ccteam/tree/master/CCFC/files/CCHttp.h
本文详细解析了CCHttp.h文件中定义的用于发送GET和POST请求的同步与异步方法,包括发送请求的参数和返回的数据类型,以及如何获取响应状态码。

被折叠的 条评论
为什么被折叠?



