NSString* url = [NSString stringWithFormat:@"%s?mt=1&qt=6045&mobilekey=%@", gURLHEADER.getData(), [[UIDevice currentDevice] uniqueIdentifier]];

NSURL *c_url = [NSURL URLWithString:url];

NSMutableURLRequest *postRequest = [[NSMutableURLRequest alloc] initWithURL:c_url];

[postRequest setHTTPMethod:@"POST"]; [postRequest setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField: @"Content-Type"];

[postRequest setTimeoutInterval:60];

NSHTTPURLResponse* response = nil;

NSData *resData = nil;

NSInteger code = 0;

int index = 0;

while (index < 2)

{

resData= [NSURLConnection sendSynchronousRequest:postRequest returningResponse:&response error:nil];

code = [response statusCode];

if (code == 200)

{

break;

}

index++;

}

[postRequest release];

if (resData)//服务器返回的数据

{

//用xml方式解析resData

}


类别:网络部分 查看评论

相关文章:

  • 2021-11-25
  • 2022-01-14
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-09-10
  • 2022-12-23
  • 2022-01-22
  • 2021-08-02
相关资源
相似解决方案