标签 OpenShift 下的文章

http://www.otokaze.cn/post/535.html
v2ex.png
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';
}

- 阅读剩余部分 -

你的PHP安装目录可能有所不同,请自行更改

安装 PHP7 Redis
cd /tmp
wget -c https://github.com/phpredis/phpredis/archive/php7.zip
unzip php7.zip
cd phpredis-php7
phpize
./configure --with-php-config=${OPENSHIFT_DATA_DIR}/bin/php-config
make -j4 && make install
sed -i "s/; End:/; End:\n\nextension=redis.so\n/g" ${OPENSHIFT_DATA_DIR}etc/php.ini

安装 PHP7 GeoIP
git clone https://github.com/Zakay/geoip.git
cd geoip
phpize
./configure --with-php-config=${OPENSHIFT_DATA_DIR}/bin/php-config --with-geoip
make -j4 && make install
wget -N http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz
gunzip GeoIP.dat.gz
mkdir ${OPENSHIFT_DATA_DIR}geoip
mv GeoIP.dat ${OPENSHIFT_DATA_DIR}geoip/GeoIP.dat
sed -i "s/; End:/; End:\n\nextension=geoip.so\ngeoip.custom_directory=${OPENSHIFT_DATA_DIR}geoip/\n/g" ${OPENSHIFT_DATA_DIR}etc/php.ini