在 UIWebView 中发布两个文本字段
我想在 UIWebView 中加载的页面中填充两个文本字段。我一直忙于 NSMutableRequests。 我的代码:
// webView is an object of UIWebView
// This is my ViewDidLoad Function
NSString *cijferString = @"leerling.degoudsewaarden.nl";
NSURL *cijferURL = [NSURL URLWithString:cijferString];
NSMutableURLRequest *request = [NSMutableURLReuqest requestWithURL:cijferURL];
NSString *body = [NSString stringWithFormat:@"wu_loginname=%@&wu_password=%@", @"username", @"password"];
[request setHTTPMethod:@"POST"];
[request setHTTPBody: [body dataUsingEncoding:NSUTF8StringEncoding];
[webView loadRequest:request];
我想要的只是将我的用户名和密码提交到网页。它将自动加载下一页。
任何帮助表示赞赏!
I want to fill two textfields in a page I loaded in UIWebView. I have been busy with NSMutableRequests.
My code:
// webView is an object of UIWebView
// This is my ViewDidLoad Function
NSString *cijferString = @"leerling.degoudsewaarden.nl";
NSURL *cijferURL = [NSURL URLWithString:cijferString];
NSMutableURLRequest *request = [NSMutableURLReuqest requestWithURL:cijferURL];
NSString *body = [NSString stringWithFormat:@"wu_loginname=%@&wu_password=%@", @"username", @"password"];
[request setHTTPMethod:@"POST"];
[request setHTTPBody: [body dataUsingEncoding:NSUTF8StringEncoding];
[webView loadRequest:request];
All I want is submit my username and password to the webpage. It will automatically load the next page.
Any help is appreciated!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
研究并使用 ASIHTTPRequest 框架,它使发送 POST 请求变得非常容易,并且通常是执行 RESTful HTTP 内容的绝佳框架。
祝你好运!
Investigate and use the ASIHTTPRequest framework, it makes sending POST requests very easy and in general is a great framework for doing RESTful HTTP stuff.
Good luck!