nshttp 请求

urlReques=[[NSString stringWithFormat:@"%@userid=%@&isVisitCount=1&sign=%@",CarUrl,Userid,SignMd5] stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];

NSLog(@"%@", urlReques);

NSURL    *url = [NSURL URLWithString:urlReques];

NSURLRequest *request = [NSURLRequest requestWithURL:url];

NSError *error = nil;

receivedData = [NSURLConnection sendSynchronousRequest:request returningResponse:nil error:&error];

NSString *xmlString = [[NSString alloc] initWithBytes:[receivedData bytes] length:[receivedData lengthencoding:NSUTF8StringEncoding];

/* 下载的数据 */

if (receivedData!= nil){

NSLog(xmlString);

} else {

NSLog(@"%@", error);

posted on 2011-08-06 10:52  风乔  阅读(217)  评论(0编辑  收藏  举报

导航