Post two textfields in UIWebView
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 setHTTPBo开发者_Go百科dy: [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!
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!
精彩评论