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);

你可能感兴趣的:(http)