Skip to content

Instantly share code, notes, and snippets.

@sqbing
Last active August 29, 2015 14:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sqbing/11389166 to your computer and use it in GitHub Desktop.
Save sqbing/11389166 to your computer and use it in GitHub Desktop.
- (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