Last active
August 29, 2015 14:00
-
-
Save sqbing/11389166 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)doLogin{ | |
// 发送登陆表单 | |
NSURL *url = [NSURL URLWithString:@"http://www.v2ex.com/signin"]; | |
loginRequest = [ASIFormDataRequest requestWithURL:url]; | |
[loginRequest addPostValue:username forKey:@"u"]; | |
[loginRequest addPostValue:password forKey:@"p"]; | |
[loginRequest addPostValue:once forKey:@"once"]; | |
[loginRequest addPostValue:@"/" forKey:@"next"]; | |
[loginRequest setUserAgentString:@"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.116 Safari/537.36"]; | |
[loginRequest setShouldRedirect:NO]; | |
[loginRequest setPostFormat:ASIURLEncodedPostFormat]; | |
[loginRequest addRequestHeader:@"Content-Type" value:@"application/x-www-form-urlencoded"]; | |
[loginRequest startAsynchronous]; | |
return; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment