开发者

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!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜