<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>All About Free &#187; perl</title>
	<atom:link href="http://www.free-z.net/tag/perl/feed" rel="self" type="application/rss+xml" />
	<link>http://www.free-z.net</link>
	<description></description>
	<lastBuildDate>Sun, 09 Oct 2011 14:00:10 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1</generator>
	
<!-- Start Of Script Generated By WP-PostViews Plus -->
<script type='text/javascript' src='http://www.free-z.net/wp-includes/js/jquery/jquery.js?ver=1.4.4'></script>
<script type="text/javascript">
/* <![CDATA[ */
jQuery.ajax({type:'GET',url:'http://www.free-z.net/wp-content/plugins/wp-postviews-plus/postviews_plus.php',data:'todowppvp=add&type=tag&id=277_1',cache:false,dataType:'script'});
/* ]]> */
</script>
<!-- End Of Script Generated By WP-PostViews Plus -->
	<item>
		<title>Twitter -&gt; Renren status sync tool</title>
		<link>http://www.free-z.net/712</link>
		<comments>http://www.free-z.net/712#comments</comments>
		<pubDate>Thu, 22 Jul 2010 04:24:52 +0000</pubDate>
		<dc:creator>Free</dc:creator>
				<category><![CDATA[技术存档]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[sync]]></category>
		<category><![CDATA[twitter]]></category>
		<category><![CDATA[人人]]></category>
		<category><![CDATA[校内]]></category>

		<guid isPermaLink="false">http://all.aboutfree.me/?p=712</guid>
		<description><![CDATA[虽然说目前网上已经有不少twitter信息同步至人人网的服务，但毕竟要把账号密码提交给别的网站，安全系数大大降低 所以还是一直在使用自己的服务器来做twitter的同步 但是淫淫网总是更新些莫名其妙的东西，所以我的更新程序也停了很长一阵子 闲来无事，便尝试着更新一下，觉得似乎也可以发布了，给更多想将twitter同步至淫淫网的朋友一个新的选择 代码是用perl编写的，推荐放在支持perl的linux主机中，并且确保linux帐户有权限运行wget，然后设置计划任务每n分钟运行一次既可 注：代码原作者为Feng Liu，我只是在他的基础上做更新而已 点击下载代码:twitter2renren Update: v1.5.1 &#8211; 修复了一个代码的bug，会导致提取到的check value不正确 #!/usr/bin/perl -w # Twitter -&#62; Xiaonei status sync tool. # Version: 1.5.1 # Date 2010/07/26 # Original Author: Feng Liu &#60;liufeng@cnliufeng.com&#62; # Updated by Rui Fu &#60;freelz@gmail.com&#62; use utf8; use Encode; use LWP::Simple; use HTML::Entities; ####################### Settings starts here ####################### # Set [...]]]></description>
			<content:encoded><![CDATA[<p>虽然说目前网上已经有不少<a href="http://www.free-z.net/tag/twitter" class="st_tag internal_tag" rel="tag" title="Posts tagged with twitter">twitter</a>信息同步至人人网的服务，但毕竟要把账号密码提交给别的网站，安全系数大大降低<br />
所以还是一直在使用自己的服务器来做<a href="http://www.free-z.net/tag/twitter" class="st_tag internal_tag" rel="tag" title="Posts tagged with twitter">twitter</a>的同步<br />
但是淫淫网总是更新些莫名其妙的东西，所以我的更新程序也停了很长一阵子<br />
闲来无事，便尝试着更新一下，觉得似乎也可以发布了，给更多想将<a href="http://www.free-z.net/tag/twitter" class="st_tag internal_tag" rel="tag" title="Posts tagged with twitter">twitter</a>同步至淫淫网的朋友一个新的选择<br />
代码是用<a href="http://www.free-z.net/tag/perl" class="st_tag internal_tag" rel="tag" title="Posts tagged with perl">perl</a>编写的，推荐放在支持<a href="http://www.free-z.net/tag/perl" class="st_tag internal_tag" rel="tag" title="Posts tagged with perl">perl</a>的linux主机中，并且确保linux帐户有权限运行wget，然后设置计划任务每n分钟运行一次既可<span id="more-712"></span></p>
<p>注：代码原作者为Feng Liu，我只是在他的基础上做更新而已</p>
<p>点击下载代码:<a href="http://all.aboutfree.me/wp-content/uploads/2010/07/twitter2renren.zip">twitter2renren</a></p>
<p>Update:<br />
v1.5.1 &#8211; 修复了一个代码的bug，会导致提取到的check value不正确</p>
<pre class="brush: perl; title: ;">

#!/usr/bin/<a href="http://www.free-z.net/tag/perl" class="st_tag internal_tag" rel="tag" title="Posts tagged with perl">perl</a> -w

# <a href="http://www.free-z.net/tag/twitter" class="st_tag internal_tag" rel="tag" title="Posts tagged with twitter">Twitter</a> -&gt; Xiaonei status <a href="http://www.free-z.net/tag/sync" class="st_tag internal_tag" rel="tag" title="Posts tagged with sync">sync</a> tool.
# Version: 1.5.1

# Date 2010/07/26
# Original Author: Feng Liu &lt;liufeng@cnliufeng.com&gt;
# Updated by Rui Fu &lt;freelz@gmail.com&gt;

use utf8;
use Encode;
use LWP::Simple;
use HTML::Entities;

####################### Settings starts here #######################
# Set your base account information here. Don't show this to others!
my $twitter_account = '';
my $xiaonei_email = '';
my $xiaonei_passwd = '';

# some machine's wget is too old, so you may need to rebuild a newer
# version and indicate the path of your own wget here.
my $wget_cmd = 'wget';

# The program needs a log file for keeping the time of your last
# tweet. Otherwise you may get your xiaonei status updated to a same
# tweet. So please keep this file!
my $logfile = 'twxn.log';
######################## Settings ends here ########################

my $twitter_url = 'http://<a href="http://www.free-z.net/tag/twitter" class="st_tag internal_tag" rel="tag" title="Posts tagged with twitter">twitter</a>.com/statuses/user_timeline/' . $twitter_account . '.xml';
my $statuses = get($twitter_url);
my @lines = split /\n/, $statuses;
my $latest_text = $lines[5];
my $latest_time = $lines[3];

if ($latest_text =~ /&lt;text&gt;(.*)&lt;\/text&gt;/) {
    $status = $1;
};
$text = decode_entities($status);

# If the log file doesn't exist, create a new one.
if (!(-e $logfile)) {
    open LOG,&quot;&gt; twxn.log&quot; or die &quot;ERROR: Cannot create log file.&quot;;
    close LOG;
    print &quot;Created a new log file: $logfile\n&quot;;
}
open LOG, &quot;&lt; $logfile&quot; || die &quot;ERROR: Cannot open log file!&quot;;
$last_text = &lt;LOG&gt;;
close LOG;

#ignore the direct reply
if ($latest_text =~ /&lt;text&gt;@(.*)&lt;\/text&gt;/) {
	$last_text = $latest_text;
}

if ($last_text ne $latest_text) {
	if ($latest_text ne &quot;&quot;) {
    my $login_cmd = $wget_cmd . ' --no-proxy -O renrenlogin.log --post-data=&quot;email=' . $xiaonei_email . '&amp;password=' . $xiaonei_passwd . '&amp;isplogin=true&amp;origURL=http://www.renren.com/Home.do&amp;domain=renren.com&quot;  --keep-session-cookies --save-cookies=renrencookie http://passport.renren.com/PLogin.do';

system($login_cmd);

#get the check value
	open CHECKFILE, &quot;&lt; renrenlogin.log&quot; || die &quot;ERROR: Cannot open log file!&quot;;
	while (&lt;CHECKFILE&gt;)
	{
		$check_list = &lt;CHECKFILE&gt;;
		if ($check_list =~ /get_check:'([^']*)'/)
		{
			$get_check = $1;
			close CHECKFILE;
		}
	}

    my $post_cmd = $wget_cmd . ' --no-proxy -O renrenlogin1.log --post-data=&quot;c=' . $text . '&amp;raw=' . $text . '&amp;isAtHome=0&amp;publisher_form_ticket=' . $get_check .'&quot;  --keep-session-cookies --load-cookies=renrencookie http://status.renren.com/doing/update.do --referer=http://status.renren.com/ajaxproxy.htm';

    system($post_cmd);

    open LOG, &quot;&gt; $logfile&quot; || die &quot;ERROR: Cannot open log file!&quot;;
    print LOG $latest_text;
    close LOG;
	}
	if ($latest_text eq &quot;&quot;) {
		print &quot;Fucking dead!&quot;;
	}
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.free-z.net/712/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

