Last active
January 8, 2019 17:13
-
-
Save saltun/0490cdd8598dce10831e to your computer and use it in GitHub Desktop.
CURL vBulletin Login and get POST - PHP
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* @author Savaş Can ALTUN <[email protected]> | |
* 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'); | |
?> |
Go to page after logging
hi with 4.22 not work "Your submission could not be processed because a security token was missing."
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
what does $posturl represent ?