0

我google了很多,但我找不到示例或教程,所以你们能帮我想一个可以登录smf论坛的代码吗?

我的猜测是我应该使用 ASIIHTTPRequest?

4

2 回答 2

0
__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];
于 2011-10-13T17:39:28.970 回答
0

您可以使用 SSI 功能:http ://simplemachines.org/community/ssi_examples.php

<?php
require("SSI.php");
// Shows a login box only when user is not logged in
ssi_login();
?> 

...

于 2012-11-08T22:43:33.207 回答