我正在使用NSMutableURLRequest
将数据发送到我的 PHP 服务器。这就是我创建请求的方式:
NSMutableURLRequest *request = [[[NSMutableURLRequest alloc] init] autorelease];
[request setURL:[NSURL URLWithString:urlString]];
[request setHTTPMethod:@"POST"];
NSString *boundary = @"---------------------------14737809831466499882746641449";
NSString *contentType = [NSString stringWithFormat:@"multipart/form-data; boundary=%@", boundary];
[request addValue:contentType forHTTPHeaderField:@"Content-Type"];
[body appendData:[[NSString stringWithFormat:@"--%@\r\n", boundary] dataUsingEncoding:NSUTF8StringEncoding]];
[body appendData:[[NSString stringWithFormat:@"Content-Disposition: form-data; name=\"%@\"\r\n\r\n", key] dataUsingEncoding:NSUTF8StringEncoding]];
[body appendData:[[NSString stringWithString:[@"whatever" objectForKey:@"message"]] dataUsingEncoding:NSUTF8StringEncoding]]; //converting strings to NSData
[body appendData:[textParams objectForKey:key]];
[body appendData:[@"\r\n" dataUsingEncoding:NSUTF8StringEncoding]];
[request setHTTPBody:body];
我的问题是,服务器接收到的数据是什么格式的?IE $_POST['message']
,那会是二进制,十六进制,base64,常规字符串吗?