OK so I got the problem to login on vbulletin forum. Thi is what i figure out:

function curl($url, $post)  {
$curl=curl_init();
	curl_setopt($curl, CURLOPT_URL, $url);
	curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
	curl_setopt($curl, CURLOPT_USERAGENT, 'Mozilla/5.0 (X11; U; Linux i686; pl; rv:1.8.0.3) Gecko/20060426 Firefox/1.5.0.3');
	curl_setopt($curl, CURLOPT_COOKIEFILE, dirname(__FILE__) . '/cookies.txt');
  curl_setopt($curl, CURLOPT_COOKIEJAR, dirname(__FILE__) . '/cookies.txt');
	curl_setopt($curl, CURLOPT_TIMEOUT, 30);
	curl_setopt($curl, CURLOPT_HEADER, 0);
	if(strlen($post)>0)
	{
		curl_setopt($curl, CURLOPT_POST, 1);
		curl_setopt($curl, CURLOPT_POSTFIELDS, $post);
	}
	$strona=curl_exec($curl);
	echo $strona;
	curl_close($curl);
}

I call the function with:

$urlroot = 'http://www.exemplary-vbulletin-forum.com/login.php?do=login';
$users = array(
$vbulletin1 = array(
'vb_login_username' => 'user_name',
'vb_login_password'=> '',
's' => '',
'securitytoken' => 'guest', 
'do'=> 'login', 
'vb_login_md5password' => md5('secret_password'), 
'vb_login_md5password_utf' => md5('secret_password')
   )
);


curl($urlroot, $users[$i]);

When i run my script I got standard vbulletin meesage:
thank you for logging user_name

Afer about 2-3 seconds the script is redirected to the main site of forum which looks like http://www.exemplary-vbulletin-forum.com/index.php?
s is changing on each script running, but i am not logged in, any ideas ???

    You probably aren't logged in after the redirect because the cookies which were set when you logged in are in the "cookies.txt" file on the server and not in your browser. Thus, when your browser redirects to the forum home page, it has no cookies to send (since it never got any).

      So i guess there is no way to manage with this issue ?

        Not that I can think of. If the forum is on a different domain than the script you're using, there's really no way to just transfer the cookie information along to the client (can't set cross-domain cookies - that'd be a security problem).

          Write a Reply...