开发者

HTTP POST request - sending username and password to the server

I'm a newcomer to the iPhone world. I'm working on an application having a login pa开发者_C百科ge. I have to send UIText value of username and password to the server. Code would be appreciated.


Look into using the ASIHTTPRequest framework to make POST requests.


You can check the user_ name and password from the severer ASIHTTPRequest framework it's the ex. of code which from the twitter request.m file

if ([challenge previousFailureCount] == 0) {
    NSURLCredential *newCredential;
    newCredential=[NSURLCredential credentialWithUser:[self username]
                                             password:[self password]
                                          persistence:NSURLCredentialPersistenceNone];
    [[challenge sender] useCredential:newCredential
           forAuthenticationChallenge:challenge];
    [newCredential release];
} else {
    [[challenge sender] cancelAuthenticationChallenge:challenge];
    // inform the user that the user name and password
    // in the preferences are incorrect
    NSLog(@"Invalid Username or Password");
}
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜