我需要一些后的参数传递给服务器,但PHP得到的$ _ POST 空数组 这是我的代码:Xcode中的WebView未通过POST参数
NSString* user=UserNameField.stringValue;
NSString* pass=PasswordField.stringValue;
NSString* ID=IDField.stringValue;
NSURL *url = [NSURL URLWithString:ENTERANCE];
url = [NSURL URLWithString:@"http://sphere-beauty.com/test.php"];
NSMutableURLRequest *req = [NSMutableURLRequest requestWithURL:url];
NSString* post=[NSString stringWithFormat:@"uname=%@&passwd=%@&id=%@",user,pass,ID];
[req setHTTPMethod:@"POST"];
[req setHTTPBody: [post dataUsingEncoding:NSUTF8StringEncoding]];
[[browser mainFrame] loadRequest:req];
谁能帮助?
设置网址然后覆盖它是什么意思? – 2012-07-13 16:30:45
那只是为了测试,看到帖子数据 – Dima 2012-07-13 16:36:40