v2ex的模拟登录以及自动签到_OpenShift
http://www.otokaze.cn/post/535.html
PHP代码稍有修改几处
v2ex_sign.php
<?php
$loginUrl = 'https://www.v2ex.com/signin'; //登录入口
$v2ex = new v2ex('username','password'); //你的账号密码,请符合v2ex的用户名规范
if(!is_dir("cookie")){mkdir("cookie",0755);} //检查cookie目录是否存在
if(!is_file($v2ex->CookiePath)){ //对已有登录状态cookie的账号,程序会自动跳过登陆
file_put_contents($v2ex->CookiePath,'');
$v2ex->getOnceAndSession($loginUrl); //获取初始状态的once值以及SESSIONID
$v2ex->login();
}
$v2ex->getOnce('https://www.v2ex.com',$v2ex->CookiePath); //获得最新Once值,用于签到
$v2ex->sign('https://www.v2ex.com/mission/daily/redeem',$v2ex->CookiePath); //执行签到步骤
$v2ex->update(); //更新过期cookie
function __autoload($className){ //自动引入类库
include $className.'.class.php';
}