0
是否有任何人有SMF版本1.1.11的一些PHP登錄捲曲代碼 我試過了,然後當我檢查捲曲輸出時記錄,但是當瀏覽器加載時,它們不再登錄SMF捲曲登錄問題php
我的代碼
function login($data)
{
if(function_exists('curl_init')) {
$_SESSION['old_url'] = $_SERVER['HTTP_HOST'] .'test';
// smf needs this sigh
// create a new cURL resource
$data = array('noverify'=>1 , 'user'=> $data['username'] , 'passwrd' => $data['password'] ,'hash_passwrd'=>$data['password'], 'cookielength'=>'60');
$ch = curl_init();
// set URL and other appropriate options
curl_setopt($ch, CURLOPT_URL, $_SERVER['HTTP_HOST'] . "/forum/index.php?action=login2");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_HEADER, 0);
$agent = "Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax)";
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($ch, CURLOPT_USERAGENT, $agent);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_COOKIEFILE, dirname(__FILE__).'/cookie.txt');
curl_setopt($ch, CURLOPT_COOKIEJAR, dirname(__FILE__).'/cookie.txt');
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
// grab URL and pass it to the browser
$a = curl_exec($ch);
//$ch_temp=curl_copy_handle($ch);
//print_r($ch_temp);
// close cURL resource, and free up system resources
curl_close ($ch);
}
}