开发者

How to use post manner to transmit username and password in order to log in a website on iphone or ipad platform?

How to use post manner to transmit username and password in order to log in a website on iphone or ipad platform?

Some one has suggest me that use ASIHTTPRequest,but I 开发者_开发问答don't know how to use it. Can somebody help me ?Thank you ........


ASIHTTPRequest has one of the best how to use pages of any library I have ever encountered. It is located here: http://allseeing-i.com/ASIHTTPRequest/How-to-use

If you need to post to a web form you could do something like this:

#define kURLString @"https://yourwebsite.com"
NSURL *url = [NSURL urlWithString:kURLString];
ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:url];
[request setPostValue:@"myname" forKey:@"username"];
[request setPostValue:@"l33td00d" forKey:@"password"];
[request setDelegate:self];
[request startSynchronous];

Although in real life you may wish to run the request asynchronous. The details on how to do that are on the page I linked. It is defiantly worth reading.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜