方便很多因为找寻Tw2other的童鞋们快速到达,特把此文置顶
现在微博众多,不可能每条消息都要动手几次分别发到自己常用的微博去,本来国内很多微博是提供把自己的内容同步到其他微博的,可是俺主要是用twitter,它可没有提供类似的功能。
虽然也可以通过其他方法来进行同步,可是要么是延迟超过1个小时,有时候甚至半天都不同步一条,要么就是会在消息前面加上其他信息,导致一条消息可能会分成2条的情况发生,这点让我不能忍受...于是Tw2other便产生了。
tw2other暂时只支持 digu、sina、zuosa、follow5、9911、豆瓣广播、鲜果联播、人间网、人人网、网易微博这几个微博,如果有其他需求!也随时可以添加上去
使用方法很简单,在任何地方支持php的虚拟主机一个(最好支持Cron的,而且服务器所在地最好在国外,国内也行,不过需要提供一个twitter api)上传Tw2other,配置好config.php中你的twitter帐号和需要同步的服务中的账号和密码,还有如果需要使用Cron来激活同步的需要配置cron.php中的URL参数。
在使用cron.php的时候,如果不想程序有输出,可以在请求中加入echo=false的参数(在页面嵌入使用的时候很有效果)
程序默认是每间隔50秒一次更新的,如果需要修改更新间隔,可以修改config.php中的INTERVAL参数。
下面是我自己的config.php和cron.php文件配置参数,给大家参考下。
config.php
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | define ( 'INTERVAL', 50 ); $twitterApi = 'http://twitter.com/'; $twitterUser = 'cluries'; $services = array ("sina" => array ('username' => 'cluries@cluries.cluries', 'password' => '************' ), "digu" => array ('username' => 'cluries', 'password' => ***********' ), "zuosa" => array ('username' => 'cluries', 'password' => '***********' ), "follow5" => array ('username' => 'your_username', 'password' => 'your_password' ), "douban" => array ('username' => 'your_username', 'password' => 'your_password' ), "xianguo" => array ('username' => 'your_email', 'password' => 'your_password' ), /*T9911就是9911.com*/ "T9911" => array ('username' => 'your_username', 'password' => 'your_password' ), /*T163就是163.com*/ "T163" => array ('username' => 'your_username', 'password' => 'your_password' ), "renren" => array ('username' => 'your_email', 'password' => 'your_password' ), "renjian" => array ('username' => 'your_username', 'password' => 'your_password' ), ); |
cron.php
1 2 3 | //这里将$url的值改为你自己tw2other所在的地址 //可以不写index.php $url = "http://intgu.com/tw2other/index.php"; |
补充:
有人反映说config.php/cron.php文件用记事本打开看不到格式,所有代码都在一行中了。这是因为这些文件是使用unix的换行标记,和windows下的换行标志不一样导致的大家可以使用editplus、UltraEdit、notepad++这类文本编辑软件来打开
关于cron的配置,一般国外主机使用 cPanel的都可以很简单的配置:在管理界面进入【时钟守护作业】,根据自己的水平选择配置模式(个人推荐选择标准模式),然后选择你要执行的时间间隔,让后输入让php解析cron.php脚本就OK了,推荐每分钟运行一次,基本上可以做到即时同步。
提示:嘀咕对推的关键字过滤比较严重,所以含有某些关键字的tweet同步到嘀咕的时候可能会被河蟹。
有问题可以再我的博客留言:http://intgu.com 或者在twitter上follow我 :http://twitter.com/cluries