I've google quite a lot but I can't find an example or tutori开发者_高级运维al, so guys can you help me think of a code which would log in smf forum?
My guess is that I should use ASIIHTTPRequest?
__block ASIFormDataRequest *request;
//login to SMF - this works
request = [ASIFormDataRequest requestWithURL: [NSURL URLWithString: @"https://imtgapp.com/forum/index.php?action=login2"]];
[request setPostValue: @"test" forKey: @"user"];
[request setPostValue: @"12345" forKey: @"passwrd"];
[request setPostValue: @"1" forKey: @"cookieneverexp"];
[request setPostValue: @"" forKey: @"hash_passwrd"]; //TODO ?
[request setValidatesSecureCertificate: NO];
[request setCompletionBlock: ^{
//TODO verify if login was successful
NSLog( @"%@", [request responseString] );
}];
[request setFailedBlock: ^{
NSLog( @"Unresolved error %@, %@", [request error], [[request error] userInfo] );
}];
[request startAsynchronous];
You can use the SSI feature: http://simplemachines.org/community/ssi_examples.php
<?php
require("SSI.php");
// Shows a login box only when user is not logged in
ssi_login();
?>
...
精彩评论