在vBulletin中使用curl登录网站 [英] Login to site with curl in vBulletin
问题描述
我一直尝试按照此链接上的说明登录(www.siamchart / forum)网站。 。使用PHP cURL登录到远程站点。我不能通过登录过去。运行以下脚本后,它将我重定向到相同的登录页面(www.siamchart / forum),但未成功登录。
I been trying to login to a site (www.siamchart/forum) by following instruction on this link.. Login to remote site with PHP cURL. I cannot past through the login. After running the following script, it redirect me to the same login page (www.siamchart/forum) without successful login.
我的代码如下..
$username="ABC";
$password="12345";
$url="www.siamchart.com/forum/login.php?do=login";
$cookie="siamchart_cookie.txt";
$postdata = "vb_login_username=".$username."&vb_login_password=".$password;
$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt ($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6");
curl_setopt ($ch, CURLOPT_TIMEOUT, 60);
curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_COOKIEJAR, $cookie);
curl_setopt ($ch, CURLOPT_REFERER, $url);
curl_setopt ($ch, CURLOPT_POSTFIELDS, $postdata);
curl_setopt ($ch, CURLOPT_POST, 1);
$result = curl_exec ($ch);
echo $result;
curl_close($ch);
编辑
论坛使用vBulletin 。这是登录页面中的脚本
Edit
The forum is using vBulletin. This is the script in the login page
<script type="text/javascript" src="clientscript/vbulletin_md5.js?v=4111"></script>
<form id="navbar_loginform" action="login.php?do=login" method="post" onsubmit="md5hash(vb_login_password, vb_login_md5password, vb_login_md5password_utf, 0)">
<fieldset id="logindetails" class="logindetails">
<div>
<div>
<input type="text" class="textbox default-value" name="vb_login_username" id="navbar_username" size="10" accesskey="u" tabindex="101" value="User Name" />
<input type="password" class="textbox" tabindex="102" name="vb_login_password" id="navbar_password" size="10" />
<input type="text" class="textbox default-value" tabindex="102" name="vb_login_password_hint" id="navbar_password_hint" size="10" value="Password" style="display:none;" />
<input type="submit" class="loginbutton" tabindex="104" value="Log in" title="Enter your username and password in the boxes provided to login, or click the 'register' button to create a profile for yourself." accesskey="s" />
</div>
</div>
</fieldset>
.
.
</script>
我做错了什么?非常感谢。
Am I do anything wrong? Thank you very much.
推荐答案
现在处理相同的问题。你不要发送密码的md5哈希,在VB它是生成的飞行,之前发送登录帖子。
am working with same problem now. Your dont send md5 hashs of password, In VB it is generated at the fly, before send a login post. To prevent shiffing of open passwords information.
此处也是post vars的完整列表:
also here is exact list of post vars:
action="login.php?do=login"
"vb_login_username"
"vb_login_password"
"s" value="" />
"securitytoken" value="guest" />
"do" value="login" />
"vb_login_md5password" />
"vb_login_md5password_utf" />
,因为它是在形式,我想现在登录。
as it was in form, am trying to login now.
这篇关于在vBulletin中使用curl登录网站的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!