Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@saltun
Last active January 8, 2019 17:13
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save saltun/0490cdd8598dce10831e to your computer and use it in GitHub Desktop.
Save saltun/0490cdd8598dce10831e to your computer and use it in GitHub Desktop.
CURL vBulletin Login and get POST - PHP
<?php
/**
* @author Savaş Can ALTUN <savascanaltun@gmail.com>
* www.savascanaltun.com.tr
* CURL vBulletin Login Example
* */
function vBulletinLogin($username,$password,$url,$posturl){
$ch = curl_init();
curl_setopt($ch, CURLOPT_HEADER,false);
curl_setopt($ch, CURLOPT_COOKIEFILE, 'veri.txt');
curl_setopt($ch, CURLOPT_COOKIEJAR, 'veri.txt');
curl_setopt($ch, CURLOPT_RETURNTRANSFER,true);
curl_setopt($ch, CURLOPT_COOKIESESSION,true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST,false);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION,true);
curl_setopt($ch, CURLOPT_USERAGENT,$_SERVER['HTTP_USER_AGENT']);
curl_setopt($ch, CURLOPT_REFERER, $url.'index.php');
curl_setopt($ch, CURLOPT_URL, $url.'login.php?do=login');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "vb_login_username=$username&vb_login_password&s=&securitytoken=guest&do=login&vb_login_md5password=".md5($password)."&vb_login_md5password_utf=".md5($password));
$exec = curl_exec($ch);
curl_setopt($ch, CURLOPT_POST, 0);
curl_setopt($ch, CURLOPT_REFERER, $url.'login.php?do=login');
curl_setopt($ch, CURLOPT_URL, $url.'clientscript/vbulletin_global.js?v=373');
$exec = curl_exec($ch);
curl_setopt($ch, CURLOPT_REFERER, $url.'login.php?do=login');
curl_setopt($ch, CURLOPT_URL, $url.'index.php');
$exec = curl_exec($ch);
curl_setopt($ch, CURLOPT_REFERER, $url.'index.php');
curl_setopt($ch, CURLOPT_URL, $posturl);
$exec = curl_exec($ch);
return $exec;
}
echo vBulletinLogin('USERNAME','PASSWORD','SİTE URL ','POST URL');
?>
Copy link

ghost commented Jan 16, 2015

what does $posturl represent ?

@saltun
Copy link
Author

saltun commented Jul 11, 2015

Go to page after logging

@codetopeer
Copy link

hi with 4.22 not work "Your submission could not be processed because a security token was missing."

@RaNaMaster
Copy link

can you please help me im not sure where to plugin the user, pass and url thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment